tiffcp: disable strip chopping when trying to convert to JBIG compression

fixes #45
This commit is contained in:
Thomas Bernard 2020-04-02 01:18:10 +02:00
parent 94679bc2d8
commit e526f620ef
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -152,12 +152,14 @@ static TIFF* openSrcImage (char **imageSpec)
no images specified, or a pointer to the next image number text 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; TIFF *tif;
char *fn = *imageSpec; char *fn = *imageSpec;
*imageSpec = strchr (fn, comma); *imageSpec = strchr (fn, comma);
if (*imageSpec) { /* there is at least one image number specifier */ if (*imageSpec) { /* there is at least one image number specifier */
**imageSpec = '\0'; **imageSpec = '\0';
tif = TIFFOpen (fn, "r"); tif = TIFFOpen (fn, mode);
/* but, ignore any single trailing comma */ /* but, ignore any single trailing comma */
if (!(*imageSpec)[1]) {*imageSpec = NULL; return tif;} if (!(*imageSpec)[1]) {*imageSpec = NULL; return tif;}
if (tif) { if (tif) {
@ -168,7 +170,7 @@ static TIFF* openSrcImage (char **imageSpec)
} }
} }
}else }else
tif = TIFFOpen (fn, "r"); tif = TIFFOpen (fn, mode);
return tif; return tif;
} }