broken multipage tiff to single page tiff conversion.

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
mmlenz
Posts: 23
Joined: 2012-05-30T08:08:21-07:00
Authentication code: 13

broken multipage tiff to single page tiff conversion.

Post by mmlenz »

Yes. We all have to deal with f'd up images on a daily basis. Here is my conundrum.

$ identify source.tif
source.tif[132] TIFF 2550x3300 2550x3300+0+0 1-bit PseudoClass 2c 339KB 0.000u 0:00.000
source.tif[133] TIFF 2550x3300 2550x3300+0+0 1-bit Bilevel DirectClass 339KB 0.000u 0:00.000
source.tif[134] TIFF 2550x3300 2550x3300+0+0 1-bit Bilevel DirectClass 339KB 0.000u 0:00.000
source.tif[135] TIFF 1688x2173 1688x2173+0+0 1-bit Bilevel DirectClass 339KB 0.000u 0:00.000
source.tif[136] TIFF 1688x2170 1688x2170+0+0 1-bit Bilevel DirectClass 339KB 0.000u 0:00.000
identify: source.tif: unknown field with tag 33000 (0x80e8) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/706

$ convert source.tif export-%d.tif
convert: source.tif: unknown field with tag 33000 (0x80e8) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/706.

$ ls -1
export-132.tif
export-133.tif
export-134.tif
export-135.tif
export-136.tif
source.tif

My software is dependant on these things actually having the proper page numbers. It looks like the scene info is being corrupted and that is what %d actually uses. How do I know that? I stumbled upon this:

## '%p' is the index
$ convert -set filename:test '%p' source.tif 'export-%[filename:test].tif'
convert: source.tif: unknown field with tag 33000 (0x80e8) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/706.

$ ls
export-0.tif

## Same convert only '%s' for scene
$ ls
export-132.tif

## Same convert only '%n' for number of pages
$ ls
export-5.tif

So it looks like for my purposes I want the %p but how do I make it so it'll split them up like %d does? Thanks!
mmlenz
Posts: 23
Joined: 2012-05-30T08:08:21-07:00
Authentication code: 13

Re: broken multipage tiff to single page tiff conversion.

Post by mmlenz »

Figured it out on my own. You have to force it with +adjoin. But of course the version of IM we are running in production doesn't appear to work (6.6.0 vs 6.6.9 that I tested with). Oh well. If I just do something like $ convert source.tif temp-source.tif it fixes the broken file and it processes fine.

ImageMagick is awesome and frustrating at the sametime. Just like my wife. LOL.

Why did the developers choose to use scene instead of using the current page index?
Post Reply