[PATCH] fix jbig in tiff container

Yuriy Kaminskiy <[email protected]> Mon, 22 Dec 2014 18:49:52 +0300
Newsgroups gmane.comp.video.graphicsmagick.bugs
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------060900010205050601070105
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: 7bit

libtiff jbig (en|de)coder supports only TIFFReadEncodedStrip (and encoder only
supports single whole-image strip); gm tries to use either ScanlineMethod, or
StripMethod depending on strip size in decoder, and always use ScanlineMethod in
encoder. Decoder fails with larger samples, encoder always fails. Force
StripMethod in tiff decoder for JBIG codec.

Unsolved: encoder side.

Samples for testing can be obtained by converting bi-level tiff to jbig by
tiffcp -r -1 -c jbig in-ccitt-g4.tiff out-jbig.tiff

--------------060900010205050601070105
Content-Type: text/x-diff;
 name="GraphicsMagick-1.3.20-tiff-jbig.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="GraphicsMagick-1.3.20-tiff-jbig.patch"

--- GraphicsMagick-1.3.20/coders/tiff.c.orig	2014-08-17 00:33:23.000000000 +0400
+++ GraphicsMagick-1.3.20/coders/tiff.c	2014-12-22 16:01:12.984095307 +0300
@@ -1845,6 +1845,10 @@
               }
             else if (TIFFIsTiled(tiff))
               method=TiledMethod;
+#if defined(COMPRESSION_JBIG)
+            else if (compress_tag == COMPRESSION_JBIG)
+              method=StrippedMethod;
+#endif
             else if ((TIFFStripSize(tiff)) <= (1024*64))
               method=StrippedMethod;
             if (photometric == PHOTOMETRIC_MINISWHITE)

--------------060900010205050601070105
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
--------------060900010205050601070105
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Graphicsmagick-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-bugs

--------------060900010205050601070105--