|AWARE [SYSTEMS]||Imaging expertise for the Delphi developer|
|TIFF and LibTiff Mailing List Archive|
LibTiff Mailing List
2011.02.12 13:16 "Re: Converting single-page TIFFs to multi-page TIFF or PDF", by John Brown
> > > Bob Friesenhahn wrote: > > > > On Sat, 5 Feb 2011, John Brown wrote: > >> > >> My plan was simply to build a list of pages that belong to one > >> document and then: > >> > >> $tiffcp page1.tif page2.tif ... pageN.tif doc.tif > >> $tiff2pdf -o doc.pdf doc.tif > >> > >> If any of the TIFFs is an OJPEG TIFF, the first command fails > >> with a long message including: > > > > You forgot to tell us what version of libtiff you are using. Of > > course it does make a difference. > > > > Bob > > > Indeed. Sorry about that. I am using the latest stable version > 3.9.4 compiled against jpeg-8b with MinGW/MSYS on Windows Vista. > > The JPEG in question is displayed as a blob by Windows Image > Preview but I can view it with XnView (www.xnview.com). > > $ tiffinfo -c -j -s test-original.tif > TIFFReadDirectory: Warning, test-original.tif: wrong data type 4 for "JpegProc"; > tag ignored. > TIFFReadDirectory: Warning, Photometric tag value assumed incorrect, assuming da > ta is YCbCr instead of RGB. > OJPEGSubsamplingCorrect: Warning, Subsampling tag is not set, yet subsampling in > side JPEG data [1,1] does not match default values [2,2]; assuming subsampling i > nside JPEG data is correct. > TIFF Directory at offset 0x8 (8) > Subfile Type: (0 = 0x0) > Image Width: 716 Image Length: 480 > Resolution: 400, 400 pixels/inch > Bits/Sample: 8 > Compression Scheme: Old-style JPEG > Photometric Interpretation: YCbCr > YCbCr Subsampling: 1, 1 > Orientation: row 0 top, col 0 lhs > Samples/Pixel: 3 > Rows/Strip: 480 > Planar Configuration: single image plane > Software: Pixel Translations Inc., PIXTIFF Version 54.1.207 > JpegInterchangeFormat: 520 > JpegInterchangeFormatLength: 408 > JpegQTables: 634 699 699 > JpegDcTables: 768 848 848 > JpegAcTables: 793 872 872 > 1 Strips: > 0: [ 928, 29221] > > Regards, > Alias John Brown. > Nobody has any ideas? Additional observations: 1) GraphicsMagick does the concatenation without warnings or errors: 'gm convert -adjoin a.tif b.tif result.tif' results in a two-page colour TIFF that can be viewed in Windows Image Preview. a.tif and b.tif are copies of the original compressed OJPEG TIFF. 2) If I comment out the section of code in tif_jpeg.c responsible for the error message JPEGSetupEncode: RowsPerStrip must be multiple of 8 for JPEG. test-jpg.tif: Error, can't write strip 0. then 'tiffcp -c jpeg:r a.tif b.tif result.tif' works. Without ':r', the colours are wrong. The problem is that I am forced to specify JPEG compression. I am going to convert thousands of TIFFs. Most of them are going to be monochrome (the usual CCITT G3 or G4). I suppose that I can work with this if I do something like: concatenate TIFFs if fail because OJPEG not supported then add '-c jpeg:r' to flags and try again end if However, I still have to comment out the RowsPerStrip error in tif_jpeg.c. I have to assume that bad things really will happen if RowsPerStrip is not a multiple of 8, so I would rather not do that. Finally, what would save me a little work is if tiffcp had a flag that would make it use new JPEG compression whenever it encounters OJPEG, instead of giving up. Back to one of my original questions: If I uncompress the TIFF using tiffcp, I can make a PDF with JPEG compression from it using tiff2pdf, but tiffcp will give the 'RowsPerStrip must be multiple of 8' message (before my modification.) Why should one utility be able to handle the file but not the other. Is it a bug? Regards, Alias John brown.