How can I do a reverse "append"? (color quantization)

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
imhere
Posts: 3
Joined: 2013-01-05T21:19:19-07:00
Authentication code: 6789

How can I do a reverse "append"? (color quantization)

Post by imhere »

Edit: This is what I am trying to do:

Example workflow: (20) "100x100" png files -> append into (1) "100x2000" png -> convert to gif -> split back into (20) "100x100" gif files.

I don't know how I would do that last step. I am working on a windows laptop.

Why do I want to do that last step? Because...

Recently I have been trying various image editing tools to create animated gifs. I am using GIMP as my main editor, but found the built-in conversion to 256-color gif to be mediocre. Tried gmic plugin, did not like the results. Tried ximagic plugin, great but it's shareware and I think only works on single image at a time. Tried RIOT plugin, good but also only works on single image at a time. Tried gifsicle, too speckled. So trying imagemagick now, the gif results look better than other free tools except for RIOT. Not sure what quantization method IM uses (is it octree?), but the neuquant method available from RIOT still looks better to me.

So what I am thinking now is create/edit my project in gimp, then save the finished layers/frames as separate png files. Then I "append" all the png frames into 1 single image with imagemagick. Then I can color quantize the appended file into 256 color gif with RIOT instead of IM. But this would only be useful if I can split the appended image back into layers/frames after.
Last edited by imhere on 2013-01-05T23:10:58-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 can I do a reverse "append"? (color quantization)

Post by fmw42 »

convert animation.gif -coalesce images_%d.png

or

convert animation.gif -coalesce +adjoin images_%d.gif

PNG does not support multi-frame files, so it does not need to have +adjoin (though it will not hurt to include it anyway).

see
http://www.imagemagick.org/script/comma ... p#coalesce
http://www.imagemagick.org/script/comma ... php#adjoin
http://www.imagemagick.org/Usage/anim_basics/
http://www.imagemagick.org/Usage/anim_basics/#coalesce
imhere
Posts: 3
Joined: 2013-01-05T21:19:19-07:00
Authentication code: 6789

Re: How can I do a reverse "append"? (color quantization)

Post by imhere »

Thanks for the reply. Hmm I don't think coalesce will do what I am thinking of. My understanding is coalesce reverses whatever was done by "-layers optimize". But what I want to do is reverse what an "append" does. Append takes multiple images and concats them into one single image. I want to further procees this single image then split it back into multiple images. Example workflow: (20) "100x100" png files -> append into (1) "100x2000" png -> convert to gif -> split back into (20) "100x100" gif files.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How can I do a reverse "append"? (color quantization)

Post by snibgo »

convert -crop 1x20@ x_%02d.gif
snibgo's IM pages: im.snibgo.com
imhere
Posts: 3
Joined: 2013-01-05T21:19:19-07:00
Authentication code: 6789

Re: How can I do a reverse "append"? (color quantization)

Post by imhere »

Thank you snibgo. Yes that is what I was looking for. I did see the commands crop/chop in the command-line options page, but thought it would have to be recalculated/repeated manually. After looking further into crop command, the examples page does a good job visually showing what is capable.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How can I do a reverse "append"? (color quantization)

Post by snibgo »

For some reason, the "@" facility isn't mentioned on http://www.imagemagick.org/script/comma ... s.php#crop . As it is so useful, perhaps whoever maintains that page might mention it. (Hint, if anyone is listening.)
snibgo's IM pages: im.snibgo.com
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How can I do a reverse "append"? (color quantization)

Post by anthony »

It is metioned but further down. the '@' was one of the later additions added to the operator

Cropping into roughly Equally Sized Divisions
http://www.imagemagick.org/Usage/crop/#crop_equal

It also has a lot of extra features, such as gaps, and overlaps, as well how how 'edges' should be handled.

more specifically see
Separating Spaced-out Tiling Images
http://www.imagemagick.org/Usage/crop/#crop_spaced
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How can I do a reverse "append"? (color quantization)

Post by snibgo »

anthony wrote:It is metioned but further down.
So it is. My apologies.
snibgo's IM pages: im.snibgo.com
Post Reply