Extract RGBI image from multipage TIFF

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?".
koyglreg
Posts: 20
Joined: 2017-01-26T14:48:04-07:00
Authentication code: 1151

Re: Extract RGBI image from multipage TIFF

Post by koyglreg »

Sorry for making the issue so complicated, but here's some new information:

VueScan actually has TWO 64-bit RGBI output options -- either a normal TIFF or a "raw" TIFF. So I just tried scanning a slide and saving it in each of these formats. In Windows Photo Viewer, the raw TIFF looks darker than the normal TIFF! I did some searching around...

From https://www.hamrick.com/vuescan/html/vuesc33.htm:
The image gamma value is 1.0 when there are two bytes (16-bits) per sample, and 2.2 when there is one byte (8-bits) per sample. Raw files saved with gamma 1.0 will look dark, but this is normal.

From https://www.photo.net/discuss/threads/r ... ed.447117/:
Vuescan RAW is just a non-inverted tif file with gamma equal to 1.

The gamma change seems to explain the difference in brightness, as well as the difference in the compare metric, fmw42. (So probably nothing to do with my exiftool commands.)

Now, if I import a normal 64-bit TIFF into VueScan, infrared clean works, except it looks kind of funky because the image is too bright. If I import a raw 64-bit tiff into VueScan, everything is perfect.

So what about my hundreds of archived two-layer TIFFs? Both layers were outputted as "normal" TIFF files (one 48-bit RGB and one 64-bit RGBI). This means the gamma is probably off for all these files -- that is, the second layers of them.

This means the raw-from-vuescan.tif file we've been using is irrelevant, because none of my archived files are "raw." (And I think this caused us some confusion.) Now it looks like I need a way to take the second layer of multipage-with-imagemagick.tif and fix its gamma so it is the same as it would be in a raw file. This would (I hope) solve the problem.

Here's a fresh scan. They are both the same image outputted directly from VueScan.
64-bit RGBI normal TIFF: https://drive.google.com/file/d/0B9eUF3 ... sp=sharing
64-bit RGBI raw TIFF: https://drive.google.com/file/d/0B9eUF3 ... sp=sharing
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extract RGBI image from multipage TIFF

Post by fmw42 »

Using your TIFF file as a test, I tried two ways to correct the gamma

Code: Select all

convert lampposts_64-bit_RGBI_TIFF.tif -gamma 0.454545 -define tif:alpha=unspecified result1.tif
or

Code: Select all

convert lampposts_64-bit_RGBI_TIFF.tif -colorspace RGB -define tif:alpha=unspecified result2.tif

Either should correct the image to be darker. But it still does not perfectly compare (even visually) to your RAW version.

I suspect the TIFF version not only has the wrong gamma but has also auto corrected to stretch the dynamic range. This is typical of processing RAW files to normal files. The camera has settings to auto white balance and to auto stretch the dynamic range. And many software tools apply some of these automatically. Perhaps Vuescan has done something like this when converting from RAW to normal.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extract RGBI image from multipage TIFF

Post by fmw42 »

P.S. If the image has been auto-stretched or auto-whitebalance it might be hard to reverse those, since you may have lost those values. However, you might check the EXIF data to see if it is still there.

Also see what VueScan does beside change the gamma in terms of auto-stretch or white-balance, etc when convert from RAW to normal.
koyglreg
Posts: 20
Joined: 2017-01-26T14:48:04-07:00
Authentication code: 1151

Re: Extract RGBI image from multipage TIFF

Post by koyglreg »

I'll look into it, but that makes sense. Chances are the effect can't be totally reversed.
Post Reply