broken multipage tiff to single page tiff conversion.
Posted: 2013-09-06T10:48:37-07:00
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!
$ 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!