Page 1 of 1

Separating each color in an animated gif into separate gifs

Posted: 2019-03-17T09:55:13-07:00
by naive
Hey guys I'm trying to separate a colored animated gif into different color files (each color in a gif should become a new gif only with that color and the rest would be transparent) so i could later bitmap each of those files to give it a bit more sharpness and maybe reduce the size. Could someone advice on how could i do that?
I've tried Fred's kmeans script but to no awail, as i only get the color values

Image



Working environment:
IM version:
Version: ImageMagick 7.0.8-26 Q16 x86_64 2019-02-09 https://imagemagick.org
OS:
Mac OS 10.12.6 (Sierra)

Thanks in advance!

Re: Separating each color in an animated gif into separate gifs

Posted: 2019-03-17T12:07:22-07:00
by fmw42
You will have to extract each frame one at a time, then for each color make all the other colors transparent using +transparent somecolor and write that to a new image. That means for each frame you will get up to 256 new images. Is that what you want? To do that, you will have to write a script loop over each of the 11 frames (after coalescing) and over each color in that frame. That will be quite a few images. You can get the list of colors using -unique-colors.

See
https://imagemagick.org/script/command- ... ransparent
https://imagemagick.org/Usage/quantize/#extract

You can reduce the size of the animation, by applying one single color map to all frames. See -remap at

https://imagemagick.org/Usage/quantize/#remap

use -dither none