diff options
| author | mayeut <mayeut@users.noreply.github.com> | 2015-08-21 19:54:22 +0200 |
|---|---|---|
| committer | mayeut <mayeut@users.noreply.github.com> | 2015-08-21 19:54:22 +0200 |
| commit | f98df1c715df24176fa616046cfabbffde680c6f (patch) | |
| tree | 0d9aeeaa76a4e3179e4fa56cfa7fa47cd9d5e619 /src/bin | |
| parent | 3109759fd772ead96ceb851ea760e6596277da22 (diff) | |
TIFF can output CMYK
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/jp2/converttif.c | 14 | ||||
| -rw-r--r-- | src/bin/jp2/opj_decompress.c | 6 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/bin/jp2/converttif.c b/src/bin/jp2/converttif.c index daddbfee..f164989f 100644 --- a/src/bin/jp2/converttif.c +++ b/src/bin/jp2/converttif.c @@ -183,7 +183,18 @@ int imagetotif(opj_image_t * image, const char *outfile) numcomps = image->numcomps; - if (numcomps > 2U) { + if (image->color_space == OPJ_CLRSPC_CMYK) { + if (numcomps < 4U) { + fprintf(stderr,"imagetotif: CMYK images shall be composed of at least 4 planes.\n"); + fprintf(stderr,"\tAborting\n"); + return 1; + } + tiPhoto = PHOTOMETRIC_SEPARATED; + if (numcomps > 4U) { + numcomps = 4U; /* Alpha not supported */ + } + } + else if (numcomps > 2U) { tiPhoto = PHOTOMETRIC_RGB; if (numcomps > 4U) { numcomps = 4U; @@ -266,6 +277,7 @@ int imagetotif(opj_image_t * image, const char *outfile) TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, tiPhoto); TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1); + strip_size = TIFFStripSize(tif); rowStride = ((OPJ_SIZE_T)width * numcomps * (OPJ_SIZE_T)bps + 7U) / 8U; if (rowStride != (OPJ_SIZE_T)strip_size) { diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index 76f592fd..ac17b69d 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -1359,12 +1359,10 @@ int main(int argc, char **argv) if(image->color_space == OPJ_CLRSPC_SYCC){ color_sycc_to_rgb(image); } - else - if(image->color_space == OPJ_CLRSPC_CMYK){ + else if((image->color_space == OPJ_CLRSPC_CMYK) && (parameters.cod_format != TIF_DFMT)){ color_cmyk_to_rgb(image); } - else - if(image->color_space == OPJ_CLRSPC_EYCC){ + else if(image->color_space == OPJ_CLRSPC_EYCC){ color_esycc_to_rgb(image); } |
