Problem splitting files with crop [SOLVED - tiff frames]

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
pdh
Posts: 8
Joined: 2013-06-14T12:07:50-07:00
Authentication code: 6789

Problem splitting files with crop [SOLVED - tiff frames]

Post by pdh »

Version: ImageMagick 6.8.9-6 Q16 x64 2014-07-22
Features: DPC OpenMP
Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps rsvg tiff webp xml zlib
Windows 7 Home premium 64-bit

I want to split a number of scanned images into two, vertically

These are scans of 35mm film negative frames, with two images per frame (i.e. they are scans of film from a half-frame camera)

I'll want to process about 30 or 40 files at a time in the same directory. Ideally each output file would share the input filename plus an identifier
(e.g. PEN-PPF-RO9-001.tif would be split into PEN-PPF-RO9-001_01.tif and PEN-PPF-RO9-001_02.tif , and similarly for all input files, thus PEN-PPF-RO9-002.tif would be split into PEN-PPF-RO9-002_01.tif and PEN-PPF-RO9-002_02.tif ... and so on)

I found this thread viewtopic.php?f=1&t=13876, and the final post there suggests using

Code: Select all

convert -crop 50%x100% +repage input_image out%d_image
Now, this does exactly what I want except that instead of two output files, I end up with four.

Code: Select all


14/08/2014  08:09        37,949,838 x.tif

D:\test\>convert -crop 50%x100% +repage x.tif y_%d.tif
convert.exe: Wrong data type 3 for "PixelXDimension"; tag ignored. `TIFFReadCus
omDirectory' @ warning/tiff.c/TIFFWarnings/824.
convert.exe: Wrong data type 3 for "PixelYDimension"; tag ignored. `TIFFReadCus
omDirectory' @ warning/tiff.c/TIFFWarnings/824.
convert.exe: Wrong data type 3 for "PixelXDimension"; tag ignored. `TIFFReadCus
omDirectory' @ warning/tiff.c/TIFFWarnings/824.
convert.exe: Wrong data type 3 for "PixelYDimension"; tag ignored. `TIFFReadCus
omDirectory' @ warning/tiff.c/TIFFWarnings/824.

D:\test>dir

14/08/2014  10:02    <DIR>          .
14/08/2014  10:02    <DIR>          ..
14/08/2014  08:09        37,949,838 x.tif
14/08/2014  10:02        17,103,919 y_0.tif
14/08/2014  10:02        17,103,919 y_1.tif
14/08/2014  10:02         1,898,650 y_2.tif
14/08/2014  10:02         1,898,650 y_3.tif

0 and 1 seem to be what I want, 2 & 3 appear to be simply smaller versions.
I realise I could just process everything and trash the unwanted files, but it would be nice to know what's going on and fix it.

I'm no power-user these days, but I can swing over to a Linux system if this is a Windows-only shortcoming.

Any help or advice welcomed
Last edited by pdh on 2014-08-14T04:01:47-07:00, edited 2 times in total.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Problem splitting files with crop

Post by Bonzo »

One thing I can see in this case is the input should be after the convert:

Code: Select all

D:\test\>convert x.tif -crop 50%x100% +repage y_%d.tif
I wonder if it is a problem with tif layers?

I would try it on a jpg also try x.tif[0] which should pick up the first layer only if there are more than one in your tif file.
pdh
Posts: 8
Joined: 2013-06-14T12:07:50-07:00
Authentication code: 6789

Re: Problem splitting files with crop

Post by pdh »

calling convert with x.tif[0] seems to work perfectly.

I had tested the original command line a few weeks ago and it worked exactly as expected, however I realise now that I ha tested it on files digitised using a different scanner & scanner software. Cardinal error in testing ...

So, thank you VERY much indeed Bonzo!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Problem splitting files with crop [SOLVED - tiff frames]

Post by Bonzo »

That's good its working - it is always annoying when you have something working and it suddenly goes wrong for no apparent reason!
Post Reply