encodeGif function

List<int> encodeGif(
  1. Image image, {
  2. int samplingFactor = 10,
})

Encode an image to the GIF format.

The samplingFactor specifies the sampling factor for NeuQuant image quantization. It is responsible for reducing the amount of unique colors in your images to 256. According to https://scientificgems.wordpress.com/stuff/neuquant-fast-high-quality-image-quantization/, a sampling factor of 10 gives you a reasonable trade-off between image quality and quantization speed. If you know that you have less than 256 colors in your frames anyway, you should supply a very large samplingFactor for maximum performance.

Implementation

List<int> encodeGif(Image image, {int samplingFactor = 10}) =>
    GifEncoder(samplingFactor: samplingFactor).encodeImage(image);