Page 1 of 1

Reduce number of colors without creating new color

Posted: 2014-08-01T08:39:41-07:00
by gamax92
I noticed that -colors seems to create new colors that are not in the original image.
Is there a way to make it use only the colors that were there, and if not can someone recommend me a tool that can?

Would doing a remap afterwards with the original image still give good results?

EDIT: Doing a remap afterwards gives more than 2 colors, and turning off dither produces horrible results

Re: Reduce number of colors without creating new color

Posted: 2014-08-01T09:14:40-07:00
by snibgo
I am surprised that "Doing a remap afterwards gives more than 2 colors". Can you supply sample command and image?

You could:
(1) Find the N most common colours in the image. Make an image containing just those colours.
(2) Remap with the image found from (1).

IM doesn't (yet) contain tools to convert histogram data into images, so step (1) involves a script.

Re: Reduce number of colors without creating new color

Posted: 2014-08-01T09:14:49-07:00
by fmw42
I do not understand. -remap should maintain the colors in the colormap image. Cay you provide an example our your input and output and exact command line. Images can be uploaded to some free hosting site such as dropbox.com (public folder) and you can put the URL her.

Edit: Sorry snibgo, we were posting at the same time.

Re: Reduce number of colors without creating new color

Posted: 2014-08-01T09:20:27-07:00
by gamax92
Image - adladl.png
Image - new.png Has new color
Image - new2.png Has three colors
Image - new3.png Is not dithered

Code: Select all

convert adladl.png -colors 2 new.png
convert adladl.png -colors 2 -remap adladl.png new2.png
convert adladl.png -colors 2 +dither -remap adladl.png