encodeGif function

Uint8List encodeGif(
  1. Image image,
  2. {bool singleFrame = false,
  3. int repeat = 0,
  4. int samplingFactor = 10,
  5. DitherKernel dither = DitherKernel.floydSteinberg,
  6. bool ditherSerpentine = false}
)

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. 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

Uint8List encodeGif(Image image,
        {bool singleFrame = false,
        int repeat = 0,
        int samplingFactor = 10,
        DitherKernel dither = DitherKernel.floydSteinberg,
        bool ditherSerpentine = false}) =>
    GifEncoder(
            samplingFactor: samplingFactor,
            dither: dither,
            ditherSerpentine: ditherSerpentine)
        .encode(image, singleFrame: singleFrame);