Overlapping frames in gif-animation (convert)

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
pb42
Posts: 5
Joined: 2018-08-19T07:12:22-07:00
Authentication code: 1152
Location: Denmark

Overlapping frames in gif-animation (convert)

Post by pb42 »

Hi IM users. I am trying to create at small (34x14 px) animated gif (a rolling pair of eyes) using IM. (Input files are transparent 34x14 tiff-files.)
I have tried
  1. convert -delay 80 -loop 0 *.tif re.gif
  2. convert -delay 80 -loop 0 -dispose previous *.tif re.gif
but the frames are overlapping (in 1. completely, in 2. partially). See (result from running 1.) https://drive.google.com/open?id=16A3Z ... RCmLJCocM4 .

How can I get a "non overlapping frame" animation with a transparent background?

/Peter
Peter Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Transparent gif via convert?

Post by snibgo »

It's hard to comment without seeing your inputs. I suggest you zip them together and paste a link to the zip.
snibgo's IM pages: im.snibgo.com
pb42
Posts: 5
Joined: 2018-08-19T07:12:22-07:00
Authentication code: 1152
Location: Denmark

Re: Overlapping frames in gif-animation (convert)

Post by pb42 »

Thanks snibgo, as per your request: https://drive.google.com/open?id=1IQe34 ... IR90zxCMUY . (It's only a subset of the tiffs - half a rolling eye :) .

It turns out that command 2. in post 1 is almost there, except that the first image (the "sleeping eye", 00-sleep.tif) is shown in all the frames (image 2, 3, ... are only shown once as wanted).
Peter Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Overlapping frames in gif-animation (convert)

Post by snibgo »

Your inputs have a range of transparencies, but the GIF format can record only binary transparency: on or off.
snibgo's IM pages: im.snibgo.com
pb42
Posts: 5
Joined: 2018-08-19T07:12:22-07:00
Authentication code: 1152
Location: Denmark

Re: Overlapping frames in gif-animation (convert)

Post by pb42 »

Hehe - there is of course this beautiful "hack": Create an empty new first (transparent) image (it doesn't matter that it's been displayed in all the frames) :lol: The result can be seen here: https://drive.google.com/open?id=19Bav6 ... L3bthhqxja .

(Command is: convert -delay 60 -loop 0 -dispose previous ../empty.tif *.tif re-using-empty-first.gif)
Peter Image
pb42
Posts: 5
Joined: 2018-08-19T07:12:22-07:00
Authentication code: 1152
Location: Denmark

Re: Overlapping frames in gif-animation (convert)

Post by pb42 »

snibgo wrote: 2018-08-19T08:37:01-07:00 Your inputs have a range of transparencies, but the GIF format can record only binary transparency: on or off.
I see, thanks. So which, preferably lossless, image file format would you recommend for the input files (I need a transparent background)?
Peter Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Overlapping frames in gif-animation (convert)

Post by snibgo »

The input file format makes no difference.

The problem is that your input images have partial transparency, and they rely on this for the effect. (All the pixels are black, but with varying transparency.) But gif doesn't support partial transparency.
snibgo's IM pages: im.snibgo.com
pb42
Posts: 5
Joined: 2018-08-19T07:12:22-07:00
Authentication code: 1152
Location: Denmark

Re: Overlapping frames in gif-animation (convert)

Post by pb42 »

Thanks snibgo. (But I'm not sure I understand what to do differently though...)

Using the above mentioned "hack" (insert an empty ad hoc first image) the final animation can be seen in my signature.
Peter Image
Post Reply