Lookup table for input/output value changes?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply

Lookup table for input/output value changes?

Post by rkw » 2010-02-23T11:39:51-07:00

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?


input range:output value

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

Thanks in advance!

User avatar
Posts: 19883
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Lookup table for input/output value changes?

Post by fmw42 » 2010-02-23T14:22:56-07:00

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?

Post by rkw » 2010-02-24T06:43:23-07:00

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests