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

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
Y3llowB3rry
Posts: 2
Joined: 2016-01-16T09:50:28-07:00
Authentication code: 1151

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

Post 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!
Last edited by Y3llowB3rry on 2016-01-16T10:43:47-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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
snibgo's IM pages: im.snibgo.com
Y3llowB3rry
Posts: 2
Joined: 2016-01-16T09:50:28-07:00
Authentication code: 1151

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply