Converting an animated gif to a custom grayscale image
Posted: 2015-02-09T21:47:27-07:00
Hi all, I've been racking my brain the last few days trying to get this to work and keep running into problems. I'm try to convert an animate gif to a 8-bit grayscale format with a custom color mapping. Essentially the grayscale file is every frame of the animated gif converted to the custom 8-bit mapping, and each frame is just appended to the previous one.
I'm able to do a standard grayscale conversion to get my basic output using:
convert out.gif -append out.gray
However this uses the standard grayscale intensity settings to convert which isn't what I need. However it does convert all the frames of the animated gif and append them to the output file correctly.
Since I need a custom color mapping, I'm using the -fx operator to do this.
convert out.gif -fx "((b*256)&224)/256 + ((g*256)&224)/2048) + ((r*256)&192)/16384)" -append out.gray
However, this only converts the very first frame of the animated gif. How can I do this to convert all frames of the gif?
Any thoughts?
Thanks,
Ken
I'm able to do a standard grayscale conversion to get my basic output using:
convert out.gif -append out.gray
However this uses the standard grayscale intensity settings to convert which isn't what I need. However it does convert all the frames of the animated gif and append them to the output file correctly.
Since I need a custom color mapping, I'm using the -fx operator to do this.
convert out.gif -fx "((b*256)&224)/256 + ((g*256)&224)/2048) + ((r*256)&192)/16384)" -append out.gray
However, this only converts the very first frame of the animated gif. How can I do this to convert all frames of the gif?
Any thoughts?
Thanks,
Ken