2014.12.23 03:11 "[Tiff] TIFF JBIG writer and scanlines", by Bob Friesenhahn

2014.12.23 15:42 "Re: [Tiff] TIFF JBIG writer and scanlines", by Yuriy M. Kaminskiy

Today I encountered this:

% tiffcp -r -1 -c jbig golfer-150-bilevel.tiff golfer-150-bilevel-jbig.tiff golfer-150-bilevel-jbig.tiff: ISO JBIG scanline encoding is not implemented.

golfer-150-bilevel-jbig.tiff: Error, can't write scanline 0.

This was due to a GraphicsMagick user reporting that scanline reading sometimes fails due to libtiff's JBIG support reporting that reading via scanlines is not supported. I used the tiffcp incantation he provided and encountered the same error as when GraphicsMagick tries to write via its scanline writer.

This is using jbigkit-2.0. I tried on a machine with jbigkit-1.6 and it worked.


Apparently, it fails when source has more than one strip.
  Image Width: 1100 Image Length: 1600
  Rows/Strip: 1600
  Image Width: 1100 Image Length: 1600
  Rows/Strip: 256
Conversion in two steps works:
tiffcp -r -1 in.tiff temp.tiff # convert to single strip
tiffcp -c jbig temp.tiff out.tiff # compress to jbig

Relevant code from tiffcp.c:


                return bias? cpBiasedContig2Contig: cpContig2ContigByRow;
// ^^^ used when changing stripe size (and fails with jbig)


                return cpDecodedStrips;
// ^^^ used when recompressing same strip size (works with jbig)