Page 1 of 1

Convert multi-page tif to individual tifs

Posted: 2015-06-28T04:23:47-07:00
by bobnic
I believe the following should work but all it produces is a copy of the original multi-page tif. I have used verbose just in case it helps. The final line of the verbose output would suggest that the resulting file would be the first image in scan0001.tif, but it really is a tif with all 5 images.

Code: Select all

convert -verbose scan0001.tif output%d.tif
scan0001.tif[0] TIFF 1286x1996 1286x1996+0+0 8-bit TrueColor sRGB 39.94MB 0.094u 0:00.097
scan0001.tif[1] TIFF 2046x1376 2046x1376+0+0 8-bit TrueColor sRGB 39.94MB 0.078u 0:00.090
scan0001.tif[2] TIFF 1806x2256 1806x2256+0+0 8-bit TrueColor sRGB 39.94MB 0.078u 0:00.082
scan0001.tif[3] TIFF 1287x2045 1287x2045+0+0 8-bit TrueColor sRGB 39.94MB 0.047u 0:00.059
scan0001.tif[4] TIFF 940x1302 940x1302+0+0 8-bit TrueColor sRGB 39.94MB 0.000u 0:00.017
scan0001.tif=>output.tif[0] TIFF 1286x1996 1286x1996+0+0 8-bit TrueColor sRGB 39.99MB 0.078u 0:00.083
The following does produce the expected individual bmp files.

Code: Select all

convert -verbose scan0001.tif output%d.bmp
scan0001.tif[0] TIFF 1286x1996 1286x1996+0+0 8-bit TrueColor sRGB 39.94MB 0.063u 0:00.060
scan0001.tif[1] TIFF 2046x1376 2046x1376+0+0 8-bit TrueColor sRGB 39.94MB 0.047u 0:00.053
scan0001.tif[2] TIFF 1806x2256 1806x2256+0+0 8-bit TrueColor sRGB 39.94MB 0.047u 0:00.045
scan0001.tif[3] TIFF 1287x2045 1287x2045+0+0 8-bit TrueColor sRGB 39.94MB 0.031u 0:00.033
scan0001.tif[4] TIFF 940x1302 940x1302+0+0 8-bit TrueColor sRGB 39.94MB 0.016u 0:00.024
scan0001.tif=>output-0.bmp[0] TIFF 1286x1996 1286x1996+0+0 8-bit TrueColor sRGB 7.705MB 0.016u 0:00.059
scan0001.tif=>output-1.bmp[1] TIFF 2046x1376 2046x1376+0+0 8-bit TrueColor sRGB 8.449MB 0.031u 0:00.071
scan0001.tif=>output-2.bmp[2] TIFF 1806x2256 1806x2256+0+0 8-bit TrueColor sRGB 12.23MB 0.063u 0:00.104
scan0001.tif=>output-3.bmp[3] TIFF 1287x2045 1287x2045+0+0 8-bit TrueColor sRGB 7.902MB 0.078u 0:00.115
scan0001.tif=>output-4.bmp[4] TIFF 940x1302 940x1302+0+0 8-bit TrueColor sRGB 3.672MB 0.078u 0:00.124
Thanks for any pointers you can provide.

Bob

Re: Convert multi-page tif to individual tifs

Posted: 2015-06-28T05:06:38-07:00
by dlemstra
You are looking for the +adjoin option (http://www.imagemagick.org/script/comma ... php#adjoin). The following command will get you the requested result:

Code: Select all

convert -verbose scan0001.tif +adjoin output%d.tif

Re: Convert multi-page tif to individual tifs

Posted: 2015-06-28T06:07:53-07:00
by bobnic
That works.

Thanks for the very quick reply.

Bob

Re: Convert multi-page tif to individual tifs

Posted: 2015-06-28T06:17:02-07:00
by bobnic
Just wondering if in fact I have stumbled upon a bug. Reading up on +adjoin:
In summary, ImageMagick tries to write all images to one file, but will save to multiple files, if any of the following conditions exist...

1. the output image's file format does not allow multi-image files,
2. the +adjoin option is given, or
3. a printf() integer format string (eg: "%d") is present in the output filename.
So shouldn't the fact that I included %d in the output file name meant that condition #3 should have "automagically" enabled +adjoin?

Bob

Re: Convert multi-page tif to individual tifs

Posted: 2015-06-28T06:59:52-07:00
by dlemstra
I just tried the command of your first post and I am getting separate files. I was not aware that using %d would also prevent the writer from writing a single file. Which version of ImageMagick are you using and what is your OS?

Re: Convert multi-page tif to individual tifs

Posted: 2015-06-28T07:48:33-07:00
by bobnic
ImageMagick 6.9.1--6 Q16 x64 on Windows 8.1

Re: Convert multi-page tif to individual tifs

Posted: 2015-06-28T08:02:44-07:00
by magick
You need 2 percents in Windows:
  • convert -verbose scan0001.tif output%%d.tif

Re: Convert multi-page tif to individual tifs

Posted: 2015-06-28T08:48:03-07:00
by snibgo
magick wrote:You need 2 percents in Windows:

convert -verbose scan0001.tif output%%d.tif
That is true, when using BAT script files. From the command line, it is false. If typed at the command line, it would create a file named "output%d.tif".