Search code examples
colorsimagemagickgrayscalepaletteindexed

How can I Convert grayscale image to false color gradient with imagemagick


input b/w, output with CLUT

I want to create false color images from grayscale input images. Similar to the typical false color images produced by nasa from b/w inputs to highlight contrast and texture. I can do this in gimp by applying a custom gradient to an indexed color b/w photo. I am sure there is a way to duplicate this with IM but, i cannot find an example in the docs or on stackoverflow. My goal is to automate the process and produce several pseudocolor outputs from each b/w input image. This is for an art project, so no great precision or scientific validity is required. Although, someone may build on my project.

An example would be producing a color relief map from a typical bump map.

Your solution worked. Thank you @MarkSetchell

create new colour look up table named rainbowCLUT.png:

convert -size 1x1! xc:black xc:red xc:orange xc:yellow xc:green xc:blue xc:violet xc:white +append -resize 255x1! rainbowCLUT.png 

apply clut to image:

convert FullMoon2010.jpg rainbowCLUT.png -clut result.png;eog result.png

Solution

  • Your solution worked. Thank you @MarkSetchell

    create new colour look up table named rainbowCLUT.png:

    convert -size 1x1! xc:black xc:red xc:orange xc:yellow xc:green xc:blue xc:violet xc:white +append -resize 255x1! rainbowCLUT.png
    

    apply clut to image:

    convert FullMoon2010.jpg rainbowCLUT.png -clut result.png;eog result.png