non-[0:1] floating-point GRAY format image

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
fluffles
Posts: 2
Joined: 2011-10-13T20:40:27-07:00
Authentication code: 8675308

non-[0:1] floating-point GRAY format image

Post by fluffles »

I have a file of floating-point numbers. They are not contained in the range [0:1]. I want to display them as an image so that the minimum value from the file is black and the maximum value is white. Must I pre-process the data to scale it to the range [0:1] before using Imagemagick for this to work? The command

Code: Select all

display -depth 32 -size 100x100 -define quantum:format=floating-point gray:<filename>
shows black for everything less than 0 and white for everything greater than 1.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: non-[0:1] floating-point GRAY format image

Post by anthony »

There are is a setting for scaling for floating point numbers in input, but no input bias option that I know about. It could be added! But I am not certain how well it works outside of HDRI versions of ImageMagick.

EG -define quantum:scale=65535.0

You will likely need HDRI version of ImageMagick (floating point internal data format), so you can read in the image without clipping, and then 'level' the image to scale the values to a more 'useful' range for display.

http://www.imagemagick.org/Usage/basics/#hdri


tell use more about your input and what you exactly want, perhaps provide a simple small image example, and we can help you more.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
fluffles
Posts: 2
Joined: 2011-10-13T20:40:27-07:00
Authentication code: 8675308

Re: non-[0:1] floating-point GRAY format image

Post by fluffles »

Thank you for the reply. What I want is to display a file that contains floating-point numbers in the range [-b,+w], and have the value '-b' be the black point, and '+w' be the white point. Since it doesn't seem to be possible to achieve this easily with ImageMagick I have decided to instead preprocess the data into the range [0,1] with an external program.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: non-[0:1] floating-point GRAY format image

Post by anthony »

Post a request for floating point bias handling in Bugs. It's probably an easy addition to go with "quantum:scale"
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply