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
gif resizing changed from 6.2.2 onward?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: gif resizing changed from 6.2.2 onward?
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..remove the transparency, then restore it after resizing...
If the transparent color is not the right background color for the original GIF (a common occurance), then flatten the image instead.
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.
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:'
Code: Select all
convert original.gif +matte -resize 25% \
-transparent '#000B45' -transparent-color '#000B45'
resized.gif
Code: Select all
convert original.gif -background '#000B45' -flatten \
-resize 25% -transparent '#000B45' resized.gif
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: gif resizing changed from 6.2.2 onward?
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
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: gif resizing changed from 6.2.2 onward?
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.
Of course if you can post any tips, methods or other findings in using IM would be help to other users.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/