When resizing a gif with imagemagick, the image quality degrades

124 Views Asked by At

When resizing a gif with imagemagick, the image quality degrades

Before resize: enter image description here

After Resize: enter image description here

I have tried below command:

convert input1.gif -coalesce -layers OptimizeFrame  -resize 309x550 -background transparent  -filter Lanczos -quality 100  output2222.gif
1

There are 1 best solutions below

0
xenoid On

Not surprised. You have a bad case of banding due to a slow gradient (shadow) with very few possible values due to the color quantization of GIF. If you convert the image directly from full-RGB to GIF, the conversion usually includes dithering to avoid such problems. But when you go from GIF to another GIF, the scaling entails pixel interpolation, which itself undoes the dithering. IM has a -dither option, but I can't make it do something useful in this case. Ditherting in IM is discussed here.