Page 1 of 1
TIFF file color reducing RGB to 256 colors: PB with white
Posted: 2008-01-11T09:39:09-07:00
by lraynal
hello,
i have a geotiff file in RGB (chich correspond to a scanned map) and i want to reduce the number of color to 256
in the current case, my geotiff file has only about 35 different colors, so the colormap is not full
i use the last image magick ImageMagick-6.3.7-9-Q8-windows-static.exe on windows Server 2003.
and when i use the command line :
convert usrp_update.tif +dither -colors 256 usrp_update_256.tif
the white color that is largely used in the image is transformed in grey value (147, 147, 147), color index 30 (last color index)
could you explain me why ?
have i forgotten a parameter in the line command ?
thanks for your help.
Re: TIFF file color reducing RGB to 256 colors: PB with white
Posted: 2008-01-13T18:30:45-07:00
by anthony
Quantize does not like to use 'pure' colors as such color tend not to best match a given set of colors. A slightly greyer color matches more colors.
For more specific information see...
Quantization does NOT Preserve Colors
http://imagemagick.org/Usage/quantize/# ... _not_exact
One solution is to to a trial run, and then extract the colors the quantization routine found! You can then adjust those colors and use
-map to apply them to the original image.
I am looking for a good (small) example of this problem and solution.
Another solution is to append a large patch of the color wanted. This will cause the quantization routine to include that specific color as being a good color to add to the final map. the appended 'patch' can then be removed.
Again I am needing a good example to demonstrate this in IM examples.
Re: TIFF file color reducing RGB to 256 colors: PB with white
Posted: 2008-01-14T02:56:51-07:00
by lraynal
i have read your proposal.
considering that there is a problem with white color (especially for my kind of image : scanned maps)
considering that white pixels stay white pixel (they represent nothing), i would propose this way :
- create a mask of the image with all the white pixels
- reducing the color of the image (as before)
- apply the white mask in the final image
what is your opinion of such a procedure ?
however, i am not sure with the command line to create and apply mask : could you help me ?
regards,
Re: TIFF file color reducing RGB to 256 colors: PB with white
Posted: 2008-01-14T19:48:07-07:00
by anthony
That will work too. but in that cause you probably want to 'normalize' the image so as to stretch the colors out rather than just mask white to white.
Re: TIFF file color reducing RGB to 256 colors: PB with white
Posted: 2008-01-15T01:39:42-07:00
by lraynal
ok we can close this discussion
but the white areas have a signification in geo-data: that means nothing is there, at that place on the earth (regarding the theme that is mapped)
so even if you change the color, there are still nothing there
therefore, that's why 'white mask' have a sense in my context.
thanks for your help