Page 1 of 1

How to apply color palette to a grayscale image

Posted: 2014-03-26T07:57:15-07:00
by RDalmagro
Hi
I am working with satellite images (an 8-bit grayscale TIFF file), and I am trying to apply it a color palette using IM. The problem is that I need to set a color different ranges of values, for example red for value between 35-65 and blue between 70-75.
I would like some help about this.
Thanks

_____________________________

http://www.realvirtual.com.mx

Re: How to apply color palette to a grayscale image

Posted: 2014-03-26T08:18:20-07:00
by snibgo
One way of doing this is to make a CLUT (colour look-up table), which can then be used for many source images. Windows BAT syntax:

Code: Select all

convert ^
  -size 1x256 gradient: -rotate 90 ^
  -fx "u>=35/255&&u<=65/255?red:u" ^
  -fx "u>=70/255&&u<=75/255?blue:u" ^
  clutfile.png
Then each image can be processed:

Code: Select all

convert in.tiff clutfile.png -clut out.tiff