Page 1 of 4
Extract RGBI image from multipage TIFF
Posted: 2017-01-26T14:57:59-07:00
by koyglreg
I have been scanning slides with VueScan. I save each slide as a "two-page" TIFF, the first page being a dust-free, viewable RGB image, and the second page being the original RGB image plus an infrared channel (the dust).
If I want to extract the second image from one of these TIFF files (so I can open the original scan in VueScan and apply changes), I do this command for ImageMagick:
Code: Select all
convert.exe "birthday.tif[1]" "C:\Users\Philip\Pictures\birthday_rgbi.tif"
The problem is, while VueScan successfully opens this file, it cannot do the infrared clean (dust removal). I know this could be a VueScan bug, but it seems that there might be something missing from my ImageMagick command which would indicate the file has an infrared channel.
I hope this issue makes sense. Any ideas as to the solution? Thanks!
Re: Extract RGBI image from multipage TIFF
Posted: 2017-01-26T15:50:51-07:00
by fmw42
Imagemagick cannot currently handle other than RGBA or CMYKA channels. It does not know about TIFF extra channels.
IM 7 internally can handle many channels in the MPC format, but there is no current reader (or writer) for TIFF with arbitrary channels.
If I misunderstand, please provide an example TIFF file.
Re: Extract RGBI image from multipage TIFF
Posted: 2017-01-26T17:07:06-07:00
by koyglreg
Thanks for the reply. It seems the output file DOES contain the infrared channel, because of the file size and the way the image appears in preview. Here in an example file. Please let me know if I'm correct, or if you have any questions.
https://drive.google.com/file/d/0B9eUF3 ... sp=sharing
Re: Extract RGBI image from multipage TIFF
Posted: 2017-01-26T17:31:29-07:00
by fmw42
Unfortunately, my ancient Photoshop CS only sees RGB, R, G, B channels and only one layer. If you have an extra infrared channel, my ancient PS does not see it. Can you make a screen snap of your Channels and Layers panels from PS that shows more than those channels and layers and post it.
Re: Extract RGBI image from multipage TIFF
Posted: 2017-01-26T17:44:30-07:00
by koyglreg
Sorry, my Photoshop also doesn't show the infrared channel. I've tried it in the past. Also, the example file I gave you has TWO images in it, and I'm trying to use the second image. I think Photoshop will only show the first image.
Re: Extract RGBI image from multipage TIFF
Posted: 2017-01-26T17:56:54-07:00
by fmw42
If the tiff file is transparent, then you have a hidden layer and only see one, but if the two images are different, then there should be two visible layers.
How do you know that you have an extra channel, if PS does not show it?
Re: Extract RGBI image from multipage TIFF
Posted: 2017-01-28T12:46:12-07:00
by koyglreg
Well, the way I combined these two TIFFs outputted from VueScan was with ImageMagick 6.9.3 Q16. This is the command I used:
Code: Select all
convert.exe cleaned_image.tif[0] original_image.tif[0] combined.tif
The first image is always 173 MB and the second is always 130 MB, and when I combine them, the output file is always 304 MB -- almost exactly 173 + 130. That's why I assumed (maybe incorrectly?) that the infrared channel was preserved. Also, the convert.exe command only takes a second or two, as if no reencoding is going on but the files are just being copied into a new file.
Re: Extract RGBI image from multipage TIFF
Posted: 2017-01-28T13:10:34-07:00
by fmw42
IM says has two layers, but my Photoshop does not see the second layer. I do not know why. Using
The first layer 16-bit per channel RGB. The second is 16-bit RGBA (with alpha channel)
How many channels and what are they in the original tif images? Do you have more than 3 channels in any of your images? Can you screen snap the layer and channel panels for each input image and show them here?
I suspect you do not mean an infrared channel, but an image that is infrared that you want as a second layer (not channel). Is that correct.
OK. I did a simple test and I think there is a bug. I cannot get PS to show two simple tif files that are combined as follows into a two-layer image. IM sees the layers, but PS does not. Perhaps IM will not write visible layers in a tiff file, but only reads multi-layer tifs. Anyway I have reported this as a potential bug. See
viewtopic.php?f=3&t=31304
Re: Extract RGBI image from multipage TIFF
Posted: 2017-02-01T18:20:42-07:00
by koyglreg
Hey, sorry for the late reply. Before I keep troubleshooting this with ImageMagick, I think I'll contact the creator of VueScan about this. I'm guessing there's something in the metadata of the original raw TIFF file which is lost when it's processed with ImageMagick.
Re: Extract RGBI image from multipage TIFF
Posted: 2017-02-01T19:14:12-07:00
by fmw42
I took two arbitrary images and converted them to tif and combined them as you did above and my PS still did not show the second layer. So I do not think it is your other tool. See my bug report at
viewtopic.php?f=3&t=31304
Re: Extract RGBI image from multipage TIFF
Posted: 2017-02-02T18:00:07-07:00
by koyglreg
I tried to recap and rephrase my issue below. Please read carefully, and thanks in advance.
Here's one scanned image I outputted from VueScan (slide scanning software). It is outputted as a 64-bit "RGBI" image. That is, RGB + infrared channel (infrared representing dust in the scanned slide). I can later re-open this file in VueScan and do "Infrared clean," meaning the software uses the infrared channel to remove the dust in the slide. This file has not been touched since it came out of VueScan.
DOWNLOAD (173 MB)
If I copy the above slide into a new TIFF using ImageMagick, I get this file. This seems to retain the alpha channel, and the file size is almost exactly the same, but when I open
this file in VueScan, infrared cleaning is now unavailable. In other words, ImageMagick somehow
changed or discarded the information saying this alpha channel is an "infrared" channel (even though it's still basically the same file size).
DOWNLOAD (173 MB)
I'm an archivist, and going forward I can simply leave future scanned TIFFs from VueScan untouched, so that the infrared channel is not lost. The problem is, I've scanned hundreds of slides using extremely slow settings -- literally weeks and weeks of work -- and converted them with ImageMagick, and if only I could convert these back to "infrared" TIFFs, I wouldn't have to rescan them. That's why I'm hoping there's a simple difference between these two files which is the difference between "alpha" and "infrared." Does that makes sense?
Maybe the authors of ImageMagick could do a comparison of these two files and determine what the difference is? This wouldn't just benefit me, but also the many other users of VueScan who may also use ImageMagick.
Thanks for the help!
Re: Extract RGBI image from multipage TIFF
Posted: 2017-02-02T18:24:05-07:00
by snibgo
These files are probably too large for me to download, but a reasonable approach would be:
1. Use exiftool to dump all the metadata from the two files. What is the difference?
2. Use exiftool to copy all metadata from the "working" file to a copy of the "non-working" file. If this fixes the problem, then you know that copying some element(s) cures the problem, so you can isolate which element(s), and create a suitable script to fix files.
Re: Extract RGBI image from multipage TIFF
Posted: 2017-02-02T19:31:06-07:00
by koyglreg
Here's the exiftool output for both files:
http://pastebin.com/3Nu5wUGN
Please scroll to the bottom to see the differences between the files.
Yesterday I tried using exiftool to copy all metadata from the original to the copy, as you said, but it didn't fix the problem. Maybe I didn't do the right command.
Re: Extract RGBI image from multipage TIFF
Posted: 2017-02-02T19:56:18-07:00
by fmw42
You do not have multi-channel TIF, you have a normal RGB TIF with an alpha channel. These two commands seem to make a new tiff that looks the same in my Photoshop
Code: Select all
convert raw-from-vuescan.tif -define tiff:alpha=unassociated raw-from-vuescan_unassoc.tif
convert raw-from-vuescan.tif -define tiff:alpha=unspecified raw-from-vuescan_unspec.tif
See if either work for you in your other tool.
Re: Extract RGBI image from multipage TIFF
Posted: 2017-02-02T23:09:43-07:00
by koyglreg
Update:
Now when I try to open
any of my ImageMagick-converted slides in VueScan, I
can do infrared clean. Previously I must have simply opened the wrong test file in VueScan, or made some mistake in ImageMagick or a VueScan setting. I'm not sure! (Maybe a little confused, though... I hope there really wasn't any issue in the first place.)
And yes, the two images resulting from your convert commands do work in VueScan, but I guess this question is irrelevant now because as I said, my images work in VueScan even without specific ImageMagick conversion settings.
BUT there's a different issue now. While the files open and infrared cleaning is available, the whole image is washed out. The alpha/infrared is more transparent than in the original, raw, untouched TIFFs directly from VueScan. It looks as if ImageMagick
changed the relative transparency of the entire alpha layer. Is this possible? Could it be related to the "White Point" or "Primary Chromaticities" EXIF data in the ImageMagick image (see pastebin link in previous post)? If so, can this be readjusted to be "normal" again?
Again, it needs to be exactly as it was before it was processed by ImageMagick. Here's what the two images look side-by-side in Windows Photo Viewer, for what it's worth. You can see the original one (on the right) is darker than the one on the left.
SEE IMAGE HERE
Thanks!