Page 1 of 1

gif resizing changed from 6.2.2 onward?

Posted: 2007-06-12T09:45:24-07:00
by lamentarsi
hi there,
i have a problem with gif resizing.
the source gifs have antialiased text in them and 1 color set to transparent.
the command used is convert -resize 25%
up to imagemagick 6.2.2 this gave perfect results.
but with imagemagick > 6.2.2 i get different results that are not really what i want.
i put up an example of what i mean here:
http://rss.fork.de/test_im/
is there any way to replicate the behaviour from 6.2.2 and below in > 6.2.2?
i tried converting to png first do the resizing in png and then converting to gif which yielded the wrong result, too.
or is this a bug in imagemagick?
thanks for helping me here and kind regards,
alexander

Re: gif resizing changed from 6.2.2 onward?

Posted: 2007-06-12T18:51:17-07:00
by anthony
The answer is simply that IM 6.2.2 and before was in fact WRONG.
You were relying on a bug in the resize function known as the 'halo bug'
See http://www.imagemagick.org/Usage/bugs/resize_halo/

This was fixed and as a result IM now correctly ignores fully transparent pixels as being fully transparent!

IM correctly shrink your images, and preserved the anti-aliasing. if you output the result as PNG you would have the right result! GIF however can not handle semi-transparency so it goes wrong. You can use various solution such as outlined in IM Examples GIF, boolean transparency
http://www.imagemagick.org/Usage/formats/#boolean_trans
to flatten your image on the right backgroudn color and preserve those semi-transparent pixels.

Alturnativally if you like the old behaviour....
Find transprency color..

Code: Select all

   identify -verbose original.gif | grep '^  Alpha:'
remove the transparency, then restore it after resizing...

Code: Select all

   convert original.gif +matte -resize 25% \
              -transparent '#000B45' -transparent-color '#000B45'
              resized.gif
If the transparent color is not the right background color for the original GIF (a common occurance), then flatten the image instead.

Code: Select all

   convert original.gif -background '#000B45' -flatten \
             -resize 25% -transparent '#000B45'   resized.gif
In this case I did not bother setting the 'hidden' color of the image, letting it re-use the original images 'hidden' color.

You can also use a -fuzz factor to control the cutoff of anti-aliasing pixels to reduce the halo effect when using this image on background that don't quite match the anti-aliasing background.

Re: gif resizing changed from 6.2.2 onward?

Posted: 2007-06-13T01:50:16-07:00
by lamentarsi
hi there,
thank you for the answers :)
this really had me confused.
will try out the workarounds right away.
and you are of course totally correct that gif is a horrible format.. i wouldn´t use it if i wouldn´t have to for this project.
thanks again,
alexander

Re: gif resizing changed from 6.2.2 onward?

Posted: 2007-06-13T21:42:58-07:00
by anthony
Let us know how you get on.

Of course if you can post any tips, methods or other findings in using IM would be help to other users.