Page 1 of 1

Lookup table for input/output value changes?

Posted: 2010-02-23T11:39:51-07:00
by rkw
I'm looking for a way to change a floating point TIFF to an indexed PNG. I need this done in a batch way, so that all input TIFFs are indexed with the same output values. The input images are all single-band.

Is there a way to use a lookup table in ImageMagick that provides min/max input values, along with the output number?

Example:

input range:output value
0.0-1.534:0
1.535-24.3922:1
25.3923-100.328:2
etc....

such that if a pixel has a source value of 10.23 the output value would be 1

Thanks in advance!

Re: Lookup table for input/output value changes?

Posted: 2010-02-23T14:22:56-07:00
by fmw42
see my unix bash script, plm at the link below

Note that for Q8 or Q16 IM compiles, grayscale values in IM are, repsectively, integers 0-255 or 0-65535. You can also use floats 0-100%.

The other way you can try to do it is using a set of -fx ternary conditional commands or possibly one long set of nested ternary conditional commands in one -fx statement. see http://www.imagemagick.org/script/fx.php

Note within -fx, graylevels are in the range of floats 0 to 1.


In order to use floating point Tiffs you must compile IM in HDRI mode; otherwise your tif will get truncated to integer values in whatever Q level you compile IM. see http://www.imagemagick.org/Usage/basics/#depth and http://www.imagemagick.org/script/high- ... -range.php

Re: Lookup table for input/output value changes?

Posted: 2010-02-24T06:43:23-07:00
by rkw
Thanks! The fx command looks like what I need - I should be able to get what I need done through a series of conditions.

Now I just need to get IM compiled correctly for hdri - my initial attempts are failing under cygwin.