MagickGetImagePixels clamping to 1.0...

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
mherbold

MagickGetImagePixels clamping to 1.0...

Post by mherbold »

I am using MagickWand to load a 32-bit float TIF HDRI file. When I use MagickGetImagePixels to get the pixels, the values are clamped to be between 0.0 and 1.0 which of course defeats the point of HDRI. How do I get MagickWand to stop clamping the values?

:?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MagickGetImagePixels clamping to 1.0...

Post by magick »

Internally, ImageMagick processes 8, 16, or 32 bit unsigned integers. ImageMagick permits you to specify a minimum, maximum, and scale to map pixels within the discrete range which should be useful for most applications. Perhaps not for yours. You could try posting a URL to your image so we can reproduce the problem.
mherbold

Re: MagickGetImagePixels clamping to 1.0...

Post by mherbold »

magick wrote: Internally, ImageMagick processes 8, 16, or 32 bit unsigned integers. ImageMagick permits you to specify a minimum, maximum, and scale to map pixels within the discrete range which should be useful for most applications. Perhaps not for yours. You could try posting a URL to your image so we can reproduce the problem.


Hey thanks for the quick reply. Basically any HDRI will show the problem. Is there a way to post small files here? I can upload a small (say 16x16) 32 bit floating point TIF image where the values are beyond the 0 to 1 range (like 4.5 or whatever). ImageMagick will chop all the numbers to 1.0. If ImageMagick processes the image as integers then I don't think there's any real good way of having full support for HDRI - the dynamic range of some of those kind of images are too great for 32 bit integers to store without introducing banding.

How do I specify minimum & maximum with ImageMagick (or actually MagickWand which is the API I am using)? If I could specify something like minimum = 0.0 and maximum = 32.0 then that would help. I would then rescale the pixel values I get back from MagickGetImagePixels by multiplying with the maximum value. Even better would be to have ImageMagick figure out what the maximum float value in the image was, scale down accordingly for use with the internal integer engine, then scale it back up if I do a MagickGetImagePixels and request floats or doubles. That would work for me with most HDRIs that I would want to use.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MagickGetImagePixels clamping to 1.0...

Post by magick »

You might be able to attach a file using this forum. Or you can send a private message.

From MagickWand, use something like
  • MagickSetOption(wand,"quantum:minimum","0.23");
To set the minimum value. Other options include quantum:maximum, quantum:scale, quantum:format (FloatingPoint, Signed, or Unsigned), and quantum:polarity (min-is-black or min-is-white). TIFF specific options include tiff:rows-per-strip and tiff:alpha (associated or unassociated).

ImageMagick is extensible and there is no reason we cannot directly support floating-point pixels internally other than you are the first to ask for this capability. We'll look into supporting it in the near-future.
Post Reply