Can't merge a gif image with a png image.

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
bkstorm
Posts: 8
Joined: 2017-04-27T23:22:30-07:00
Authentication code: 1151

Can't merge a gif image with a png image.

Post by bkstorm »

I have two image: a GIF image and a PNG image.
the PNG image:
Image
the GIF image:
Image

I use the command below to merge two images:

Code: Select all

convert banana-bg.png null: \
\( banana.gif -coalesce \) -compose DstOver -layers Composite null: \
-set loop 0 -layers RemoveDups -layers RemoveZero \
finish.gif
and here is the result:
Image
As what you see, it's not what I expect.

I try this command with another GIF image, it works fine.
Image

Image

What's the problem?
Version: ImageMagick 7.0.7-25 Q16 x86_64 2018-03-04 http://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can't merge a gif image with a png image.

Post by fmw42 »

try this

Code: Select all

convert banana-bg.png  \
null: \
\( banana.gif -coalesce \) \
-compose DstOver -layers Composite \
-set dispose previous \
-layers RemoveDups \
-layers RemoveZero \
-layers optimize \
-loop 0 \
finish.gif
Post Reply