From e526f620efa1931d3ecf2d029e2e81f5ad313d1d Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Thu, 2 Apr 2020 01:18:10 +0200 Subject: [PATCH] tiffcp: disable strip chopping when trying to convert to JBIG compression fixes #45 --- tools/tiffcp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/tiffcp.c b/tools/tiffcp.c index 7539140a..345c6f6d 100644 --- a/tools/tiffcp.c +++ b/tools/tiffcp.c @@ -152,12 +152,14 @@ static TIFF* openSrcImage (char **imageSpec) no images specified, or a pointer to the next image number text */ { + /* disable strip shopping when using jbig compression */ + const char *mode = (defcompression == COMPRESSION_JBIG) ? "rc" : "r"; TIFF *tif; char *fn = *imageSpec; *imageSpec = strchr (fn, comma); if (*imageSpec) { /* there is at least one image number specifier */ **imageSpec = '\0'; - tif = TIFFOpen (fn, "r"); + tif = TIFFOpen (fn, mode); /* but, ignore any single trailing comma */ if (!(*imageSpec)[1]) {*imageSpec = NULL; return tif;} if (tif) { @@ -168,7 +170,7 @@ static TIFF* openSrcImage (char **imageSpec) } } }else - tif = TIFFOpen (fn, "r"); + tif = TIFFOpen (fn, mode); return tif; }