Gif with transparent color

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
Granular
Posts: 2
Joined: 2012-09-07T11:15:03-07:00
Authentication code: 67789

Gif with transparent color

Post by Granular »

Hello! I tried to create an animation with transparent background using the utility "convert" and saw the problem.

Code: Select all

convert.exe -transparent red  -delay 20 *.bmp 3.gif
1.bmp - Image
2.bmp - Image
3.gif - Image

The second picture shows without erasing the first. Please tell me the solution to this problem. :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Gif with transparent color

Post by fmw42 »

jpg does not have a solid red color, so you need to use -fuzz. second, the -transparent should be after the input images. third you need to set the disposal method.

try

convert -dispose background -delay 50 1.jpg 2.jpg -fuzz 20% -transparent red -loop 0 3.gif


see
http://www.imagemagick.org/Usage/anim_basics
Granular
Posts: 2
Joined: 2012-09-07T11:15:03-07:00
Authentication code: 67789

Re: Gif with transparent color

Post by Granular »

Thank you :)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Gif with transparent color

Post by anthony »

You also need to set the appropriate disposal.

See IM Examples GIF Animation Basics, Displosals
http://www.imagemagick.org/Usage/anim_basics/#dispose

NOTE that all frames are disposed of completely at the end of the loop, before looping. The last frames disposal setting is thus irrelevant.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply