Simulating multi-page TIF from scanner

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
Jossie
Posts: 25
Joined: 2015-01-31T03:45:52-07:00
Authentication code: 6789

Simulating multi-page TIF from scanner

Post by Jossie »

Hello,

my scanner delivers scans as 3-page TIFs: RGB-scan, preview (lower resolution), IR-scan. Images are 48bit/pixel for RGB/preview and 16bit/pixel for IR. I want to make changes to the RGB- and IR-scans and then recombine the images so I can continue using the results like the original files in the scan program. However, the following procedure does not work:
  • magick convert original[0].tif original_RGB.tif
  • magick convert original[1].tif original_preview.tif
  • magick convert original[2].tif original_IR.tif
  • Now I make changes in the RGB- and IR images --> simulate_RGB.tif and simulate_IR.tif
  • magick convert -endian MSB simulate_RGB.tif original_preview.tif simulate_IR.tif simulate.tif
  • exiftool -tagsfromfile original.tif -all:all simulate.tif
Note: The manipulations do not change image dimensions, only the pixel values are changed.

If I open the simulated image in the scan software, the IR-channel, i.e. page 2, is not recognized. This also happens if I do not change anything in the individual images, once separated, and just recombine them.

Either convert does something for me unexpected or EXIFtool does not make an identical copy of the metadata.
I would be very thankful for any hints, how to solve this problem.

Many thanks and best wishes

Hermann-Josef
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Simulating multi-page TIF from scanner

Post by fmw42 »

First, If using IM 7, you should specify only magick and not magick convert.

Please always provide your IM version and platform when asking questions, since syntax may vary.

ImageMagick cannot create multi-layer tiffs at this time. It creates multi-page tiffs. All the pages are there, but will not show in Photoshop.
Jossie
Posts: 25
Joined: 2015-01-31T03:45:52-07:00
Authentication code: 6789

Re: Simulating multi-page TIF from scanner

Post by Jossie »

Hello,

thanks for your answer.

I am using ImageMagick 7.0.5-0 Q16 x64 2017-02-20 on Windows 10 from the cmd-window.

The goal is a multi-page tif. I can see the pages of the output file with exiftool and in IrfanView, but there must be some difference to the original leading to the problem.

I also do always get little endian, regardless if I specify -endian MSB or -endian LSB. What do I do wrong??

Hermann-Josef
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Simulating multi-page TIF from scanner

Post by fmw42 »

Jossie wrote: 2017-08-03T10:00:54-07:00
The goal is a multi-page tif. I can see the pages of the output file with exiftool and in IrfanView, but there must be some difference to the original leading to the problem.

I also do always get little endian, regardless if I specify -endian MSB or -endian LSB. What do I do wrong??

Hermann-Josef
I am not sure what you are asking in the first part above. What do you mean by "but there must be some difference to the original leading to the problem."? What problem? What difference are you expecting. Perhaps you can post an example input and output image by uploading to some free hosting service such as dropbox.com and put the URLs here.

Use magick in place of magick convert. Put your -endian command at the end.
Jossie
Posts: 25
Joined: 2015-01-31T03:45:52-07:00
Authentication code: 6789

Re: Simulating multi-page TIF from scanner

Post by Jossie »

Good evening from Europe,

let me describe my goal without reference to any commands in imagemagick.

The scanner output is a multipage TIF (RGB, preview, IR) with a given set of metadata, which contain the information for the second part of the scanner software (after scanning) which is image processing of the raw scanner data. I want to make changes to the raw scanner data, i.e. change the RGB- and the IR-image (not in image dimensions but only in pixel values). To do this, I use imagemagick to separate the pages into individual images, which I process. Then I want to recombine the processed images into a multipage TIF, which should be processed by the scanner software -- not realising, that there had been changes to the pixel values.

All this I can accomplish with imagemagick but then comes the problem: The resulting multipage TIF is not completely compatible with the original. The software does not recognize the third page, i.e. the IR-channel. I would have thought, if I copy all the metadata (with EXIFtool) from the original input image to the output image, created with imagemagick, the scanner software should not realize that there had been some manipulations. But it does and that is my problem.

Putting the -endian at the end of the command does not work:

"magick SF_Dia_4850.tif[0] SF_Dia_4850_0.tif -endian MSB" gives an error message "'SF_Dia_4850_0.tif': No such file or directory.."

Hermann-Josef
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Simulating multi-page TIF from scanner

Post by fmw42 »

It should be

Code: Select all

magick simulate_RGB.tif original_preview.tif simulate_IR.tif -endian MSB simulate.tif
I cannot help with the EXIF stuff.
Jossie
Posts: 25
Joined: 2015-01-31T03:45:52-07:00
Authentication code: 6789

Re: Simulating multi-page TIF from scanner

Post by Jossie »

Hi,

I had tried both versions:

magick SF_Dia_4850_0.tif SF_Dia_4850_1.tif SF_Dia_4850_2.tif -endian MSB SF_Dia_4850_sim.tif
magick SF_Dia_4850_0.tif SF_Dia_4850_1.tif SF_Dia_4850_2.tif -endian LSB SF_Dia_4850_sim.tif

to create a multipage TIF.

And both give as a resulting format the little endian, as shown by EXIFtool: "EXIF byte order: Little-endian (Intel, II)" for the output file SF_Dia_4850_sim.tif.

What am I doing wrong or interpreting wrong???

Hermann-Josef
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Simulating multi-page TIF from scanner

Post by fmw42 »

That would appear to be a bug.

Code: Select all

convert logo: logo: logo: -endian MSB logo.tif
Image: logo.tif
Format: TIFF (Tagged Image File Format)
Mime type: image/tiff
Class: PseudoClass
Geometry: 640x480+0+0
Units: PixelsPerInch
Type: Palette
Base type: Palette
Endianess: LSB
Colorspace: sRGB
...
Properties:
date:create: 2017-08-03T12:23:05-07:00
date:modify: 2017-08-03T12:23:05-07:00
signature: 5c701306a9a985a0c93c8d11a1e761d7f8637577697fc60d7189b221388f8edf
tiff:alpha: unspecified
tiff:endian: lsb
tiff:photometric: palette
tiff:rows-per-strip: 480
tiff:subfiletype: PAGE
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Simulating multi-page TIF from scanner

Post by fmw42 »

Jossie
Posts: 25
Joined: 2015-01-31T03:45:52-07:00
Authentication code: 6789

Re: Simulating multi-page TIF from scanner

Post by Jossie »

Good morning,

thank you very much for your help. Now the endianness is correct. Unfortunately the third image is still not recognized. So there must be some other issue. I will now look into the metadata and see if there is still some difference.

Hermann-Josef
Jossie
Posts: 25
Joined: 2015-01-31T03:45:52-07:00
Authentication code: 6789

Re: Simulating multi-page TIF from scanner

Post by Jossie »

Hello,

just for completeness: The problem is solved. It was the metadata. In the original image the tag subfiletype for IFD0, IFD1 and IFD2 were "Full resolution image", "Reduced-resolution image", and "Transparency mask". But in the three-page-TIF created with imagemagick, all three tags were set to "Single page of multi-page image". Once I had changed that with EXIFtool (and the help of Phil Harvey), I could open the updated image in the scanner software including the IR channel.

Hermann-Josef
Post Reply