Skip to content

Why GIF Quality has no effect

Copy page

Changing GifExportParams.Quality in govips may have little effect on the resulting GIF. First check whether export uses libvips’ native gifsave; that path does not use a JPEG-style quality parameter.

  • Changing GifExportParams.Quality barely changes the output GIF size.
  • Expecting JPEG-like quality semantics to control GIF quality, with no effect.

libvips’ native gifsave has only parameters such as dither, effort, bitdepth, and interlace, and no quality. It has no JPEG-style “quality setting” concept — GIF is a palette format whose appearance is governed by a limited colour count.

GifExportParams.Quality exists because of an old path: on older libvips (below 8.12) gifsave falls back to magicksave (provided by ImageMagick), which is one of the few paths that honours quality. On native gifsave the field has no effect — so the maintainers only annotated it rather than removing it.

To control GIF output, use the parameters native gifsave supports instead of quality. GifExportParams in govips actually exposes:

  • Effort: compression effort (affects file size and encoding time).
  • Bitdepth: colour bit depth (affects colour count and size).
  • Dither: dithering, which affects rendering quality but not size directly.

(The v2.19.0 source comments state it precisely: Quality is only used with vips < 8.12 via the magicksave fallback, and is ignored by native gifsave.)

  1. Confirm whether your libvips uses native gifsave (newer versions do).
  2. Watch size change with Effort / Bitdepth to verify the parameters take effect.
  3. Do not treat Quality as a size control on the native gifsave path.
  • You expect Quality to work on your libvips version’s native gifsave — that is not a bug for native gifsave.
  • You expect lossy GIF quality to match JPEG — GIF is a palette format, so the semantics differ.
  • This page was checked against the native gifsave path in govips v2.19.0 and libvips 8.17.3. Older ImageMagick fallback paths behave differently.

Different libvips releases can select different GIF save paths. Base conclusions on the operation registered in the target environment.