There seems to be nothing in "identify -verbose" output that says whether an image is integer or floating-point (HDRI).
Could something be added, please?
identify -verbose HDRI images
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
identify -verbose HDRI images
snibgo's IM pages: im.snibgo.com
Re: identify -verbose HDRI images
Your request is ambiguous. Do you want to know if the original image pixels is something other than whole numbers? Or if the pixel components exceed the quantum range (typically 0 to 65535) or the current image had pixels that are not whole numbers? What would the verbose output of identify look like for identifying HDRI images?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: identify -verbose HDRI images
The particular need is to establish whether the datatype of single image in a .miff file is integer or floating-point. This is the actual storage format, independent of the values. I can't see a way to do that.
I can easily read pixels with HDRI IM and see if any are outside 0 to 100%. Without much difficulty, I can find whether all values are whole numbers.
When IM reads a file, there must be metadata that says whether the format is integer or fp. I'd like IM to make this visible in "identify -verbose". (If the image came from "xc:" or whatever, not from a file, then the metadata wouldn't be set. That's fair enough.)
I suggest an output like:
FileDatatype: Integer
FileDatatype: Floating-point
FileDatatype: Unknown
I can easily read pixels with HDRI IM and see if any are outside 0 to 100%. Without much difficulty, I can find whether all values are whole numbers.
When IM reads a file, there must be metadata that says whether the format is integer or fp. I'd like IM to make this visible in "identify -verbose". (If the image came from "xc:" or whatever, not from a file, then the metadata wouldn't be set. That's fair enough.)
I suggest an output like:
FileDatatype: Integer
FileDatatype: Floating-point
FileDatatype: Unknown
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: identify -verbose HDRI images
Slightly off topic, if you do not already know, MIFF needs the following define to preserve floating point values in HDRI as per mention in the define section of the options page documentation
quantum:format=type Set the type to floating-point to specify a floating-point format for raw files (e.g. GRAY:) or for MIFF and TIFF images in HDRI mode to preserve negative values.
quantum:format=type Set the type to floating-point to specify a floating-point format for raw files (e.g. GRAY:) or for MIFF and TIFF images in HDRI mode to preserve negative values.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: identify -verbose HDRI images
Thanks, but my question is, how do I find the datatype used in an image file? My immediate need is for MIFF files, but the question applies to any file type.
IM must know the datatype in order to read the pixels, but I can't see how to get this information from IM.
I may be missing something really obvious.
IM must know the datatype in order to read the pixels, but I can't see how to get this information from IM.
I may be missing something really obvious.
snibgo's IM pages: im.snibgo.com
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: identify -verbose HDRI images
I'll explain the problem I'm trying to solve.
I have many general-purpose scripts, chiefly for processing photographs. It is important that they don't lose data more than necessary. Some input images will be stored as integer datatype, others as floating-point. I could operate on the safe side and always process and save as HDRI. But this increases space and time. Some operations take 4 or 5 times as long with HDRI. One minute becomes five minutes. One hour becomes five hours.
So I want to find at the start of the script whether the image is HDRI (I mean, whether the datatype is floating-point). If it is, the script will use a version of IM with HDRI at the appropriate Q-number.
Two tests can ask the question: "Is this image HDRI?"
1. "identify -verbose" or a "-format" tells me if any values are outside 0 to 100%.
2. A little more work (I could write a simple process module) would tell me whether all the values are integers.
But these tests involve reading the image with large-Q HDRI, which is what I'm trying to avoid. And the answers can only be "yes" or "maybe". Getting a definitive answer from the metadata seems the obvious solution.
I have many general-purpose scripts, chiefly for processing photographs. It is important that they don't lose data more than necessary. Some input images will be stored as integer datatype, others as floating-point. I could operate on the safe side and always process and save as HDRI. But this increases space and time. Some operations take 4 or 5 times as long with HDRI. One minute becomes five minutes. One hour becomes five hours.
So I want to find at the start of the script whether the image is HDRI (I mean, whether the datatype is floating-point). If it is, the script will use a version of IM with HDRI at the appropriate Q-number.
Two tests can ask the question: "Is this image HDRI?"
1. "identify -verbose" or a "-format" tells me if any values are outside 0 to 100%.
2. A little more work (I could write a simple process module) would tell me whether all the values are integers.
But these tests involve reading the image with large-Q HDRI, which is what I'm trying to avoid. And the answers can only be "yes" or "maybe". Getting a definitive answer from the metadata seems the obvious solution.
snibgo's IM pages: im.snibgo.com