Page 1 of 1

[Solved] How to +append a gif and superpose the layers?

Posted: 2016-01-16T10:10:36-07:00
by Y3llowB3rry
Hi!

I'm new to this, and have been using the search option (and read a huge part of the documentation), to no avail. Redirect me to the correct section if necessary.

I've been trying to convert an online gif's first 6 frames into an appended .png image (in order to use that as a bitmap in Rainmeter).

Code: Select all

convert.exe +append "http://adressOfTheGif[0-6]" converted.png
The thing is, the gif in question (http://www.meteox.com/images.aspx?jaar= ... n=&tijdid=) renders this result http://s28.postimg.org/nhc5mjh5p/converted.png: only the changes from the previous frame are appended (with an alpha canal on the rest, I assume).

Using the -flatten option gives me a black background on the frames 1 to 6, and I've also looked into -coerce but I can't get it to give me the result I want.

How do I use the convert tool to give me an appended .png with each frame only superposing the new contents onto the last?

Thank you very much for your time!

Re: How to +append a gif and superpose the layers?

Posted: 2016-01-16T10:31:06-07:00
by fmw42
This works for me on IM 6.9.3.0 Q16 Mac OSX

Code: Select all

convert "http://www.meteox.com/images.aspx?jaar=-3&voor=&soort=exp&c=&n=&tijdid=[0-5]" -coalesce +append tmp.png

Re: How to +append a gif and superpose the layers?

Posted: 2016-01-16T10:32:46-07:00
by snibgo
1. "-append" should come after the input images, not before.

2. The gif is compressed. "-layers coalesce" will uncompress it.

3. [0-6] will give you 7 frames, not 6.

Code: Select all

convert in.gif[0-5] -layers coalesce +append out.png

Re: How to +append a gif and superpose the layers?

Posted: 2016-01-16T10:43:25-07:00
by Y3llowB3rry
Should have given the precisions: I'm in IM 6.9.3.0 Q16 on W10

Thank you so much! Both of you! :D

For someone that may have the same question:

Put the arguments after the image input, and put the -coalesce function before the append.

Re: How to +append a gif and superpose the layers?

Posted: 2016-01-16T10:45:45-07:00
by fmw42
Put the arguments after the image input, and put the -coalesce function before the append.
Correct. IM 6 proper syntax is different from unix scripting. Raster images come right after convert, settings come before operators and operators are order sensitive.

See http://www.imagemagick.org/Usage/basics/#cmdline

Re: [Solved] How to +append a gif and superpose the layers?

Posted: 2016-01-16T10:53:12-07:00
by snibgo

Code: Select all

convert in.gif[0-5] -layers coalesce +append out.png
Think of these as sequential operations that will be done in the order you give. First, read the gif. Next, decompress it (with either "-layers coalesce" or "-coalesce"). Then, append the images together. Finally, write the image.