Making color transparent on animated gifs

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
PaulLee
Posts: 2
Joined: 2016-10-16T14:24:10-07:00
Authentication code: 1151

Making color transparent on animated gifs

Post by PaulLee »

Hi,
This is my first post, please be kind :-)

I have a couple of animated gifs that I downloaded and I'd like to make a specific color (black) transparent in each of the layers of the gifs. Is there a simply way to do it via the command line?

Best wishes

Paul
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Making color transparent on animated gifs

Post by fmw42 »

Code: Select all

convert image.gif -coalesce -transparent black -layers optimize result.gif
If the color is not perfectly black, then you can add -fuzz XX% to consider near-black as if it were black.

Code: Select all

convert image.gif -coalesce -fuzz 5% -transparent black -layers optimize result.gif
See
http://www.imagemagick.org/Usage/anim_basics/
http://www.imagemagick.org/Usage/anim_opt/
http://www.imagemagick.org/Usage/anim_mods/


Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620

For novices, see

viewtopic.php?f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
Post Reply