Page 1 of 1

choose starting frame (different than frame 0) for a GIF

Posted: 2019-10-05T01:51:10-07:00
by yeneb
I'm using ImageMagick-7.0.6-Q16 on windows 10 via command line

I currently use a bat file I created to convert PNG sequences into GIFs while resizing and adding a text watermark in the process. It works fine, though in some cases I want to have the starting frame to be different (frame 25 for example) than frame 0, but still loop completely.

i.e. GIF start on 25f play through the end to frame 90 then continue 1 to 24 and loop.

my current solution has been batch renaming the files to choose the starting frame but then I have to alter all the provided frames and it's quite time consuming.

Ideally I'd like to have a way to set in the bat file the starting frame for the GIF and still loop through all provided images from the png sequence.

Is this possible?

Re: choose starting frame (different than frame 0) for a GIF

Posted: 2019-10-05T10:38:53-07:00
by fmw42
What about

Code: Select all

magick animate movie.gif[1--1]
to start with the second frame (skip frame 0) and go the last

Re: choose starting frame (different than frame 0) for a GIF

Posted: 2019-10-05T11:25:37-07:00
by snibgo
If you have read many images and want your GIF to start after the first 25 of those images, you can move those to the end of the list:

Code: Select all

magick *.png ( -clone 0-24 +write mpr:FIRST -delete 0--1 ) -delete 0-24 mpr:FIRST out.gif

Re: choose starting frame (different than frame 0) for a GIF

Posted: 2019-10-05T13:14:27-07:00
by GeeMack
If you want to take some frames from the beginning and put them at the end, you can use "-duplicate" and "-delete" like this...

Code: Select all

convert input.gif -duplicate 1,0-4 -delete 0-4 result.gif
That would duplicate five frames from the beginning, frames number 0 through 4, and place them at the end of the animation. Then it deletes the original frames 0 through 4. That will start the animation on frame 5, or the original sixth frame.

Re: choose starting frame (different than frame 0) for a GIF

Posted: 2019-10-05T14:02:38-07:00
by snibgo
Ah, yes, thanks GeeMack. I thought there was a better way.