Page 1 of 1

Color reduction issue - limited colors - image quality

Posted: 2013-05-07T16:06:23-07:00
by objuan
Hi everyone.

Relatively new to imagemagick but very impressed so far. I am trying to reduce the number of colors in a composite image. I basically am creating a canvas/background and composing/combining it with a logo that has a transparent background. The composed image has to only use the the colors in the background and the logo. I also have to resize the logo to scale it to be consistent with the background/canvas size. Let's say I have a background that is 1 color, and a logo that has 4 colors. I can only use a total of 5 colors. When I combine the 2 images, however, I get a dithered edge that creates many more colors. If I specify the number of colors to 5, I get jagged edges around the logo. The logo is clean before it gets composed, and the background is only 1 color. If anyone can help with the right combination of Imagemagick commands to get the end result, I would be very grateful.

Kind regards,
objuan

Re: Color reduction issue - limited colors - image quality

Posted: 2013-05-07T16:47:49-07:00
by fmw42
That is likely due to the anti-aliasing in the alpha channel which causes a mix of colors when compositing. Your alpha channel is likely 8-bit and not binary.

The best I can suggest is to create an image of only the colors you want. Combine your images. Then use -remap with the colormap image to reassign the colormap to use only your colors. see

http://www.imagemagick.org/Usage/quantize/#remap

but use +dither or -dither none to turn off dithering if you want.


see

http://www.imagemagick.org/Usage/quantize/
http://www.imagemagick.org/script/quantize.php

Re: Color reduction issue - limited colors - image quality

Posted: 2013-05-15T18:52:00-07:00
by objuan
Thank you fmw42!!! I will try that. I'll let you know what I find. Just coming back to the issue, so I apologize for not saying thanks earlier! I really appreciate it!