Re: Delete or exchange background color of animated gif?
Posted: 2008-12-14T18:25:52-07:00
All three images contain 'shadow effects'.
these are the gray regions under or around the main object in the image, and those are tied to the background color.
Basically if you want to make the white background transparent, the 'shadow effects' would have to be made semi-transparent, which is NOT posible to do in GIF images.
GIF animations with shadow effects MUST be tied into some specific background or background color, or dithered in some way to allow the background to show through.
See IM Examples, Common File Formats, GIF, Background
http://www.imagemagick.org/Usage/formats/#bgnd
for just ONE frame of a GIF.
And Semi-transparency handling for GIF animation Optimization
http://www.imagemagick.org/Usage/anim_o ... itrans_opt
for various dithering methods you can use to handle.
You may especially like to look at Ordered Dithering Techniques
http://www.imagemagick.org/Usage/quanti ... red-dither
Now for extracting the shadow effect from the white background.
There are a number of ways. But as you are doing this on white, I can say you will have a easier time.
Basically mask out the 'opaque areas' then convert shadows di transparency and color them black. This is similar to the non-white double-thresholding method given in
http://www.imagemagick.org/Usage/channe ... antialised
Though it is simpler, I have not created an example for it yet.
In Summery, you will have to figure out how you want to handle 'shadow effects', the best method being to tie the animation to a specific background color or a rough background pattern.
these are the gray regions under or around the main object in the image, and those are tied to the background color.
Basically if you want to make the white background transparent, the 'shadow effects' would have to be made semi-transparent, which is NOT posible to do in GIF images.
GIF animations with shadow effects MUST be tied into some specific background or background color, or dithered in some way to allow the background to show through.
See IM Examples, Common File Formats, GIF, Background
http://www.imagemagick.org/Usage/formats/#bgnd
for just ONE frame of a GIF.
And Semi-transparency handling for GIF animation Optimization
http://www.imagemagick.org/Usage/anim_o ... itrans_opt
for various dithering methods you can use to handle.
You may especially like to look at Ordered Dithering Techniques
http://www.imagemagick.org/Usage/quanti ... red-dither
Now for extracting the shadow effect from the white background.
There are a number of ways. But as you are doing this on white, I can say you will have a easier time.
Basically mask out the 'opaque areas' then convert shadows di transparency and color them black. This is similar to the non-white double-thresholding method given in
http://www.imagemagick.org/Usage/channe ... antialised
Though it is simpler, I have not created an example for it yet.
In Summery, you will have to figure out how you want to handle 'shadow effects', the best method being to tie the animation to a specific background color or a rough background pattern.