TIFF can output CMYK
This commit is contained in:
parent
3109759fd7
commit
f98df1c715
|
@ -183,7 +183,18 @@ int imagetotif(opj_image_t * image, const char *outfile)
|
||||||
|
|
||||||
numcomps = image->numcomps;
|
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;
|
tiPhoto = PHOTOMETRIC_RGB;
|
||||||
if (numcomps > 4U) {
|
if (numcomps > 4U) {
|
||||||
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_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||||
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, tiPhoto);
|
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, tiPhoto);
|
||||||
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
|
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
|
||||||
|
|
||||||
strip_size = TIFFStripSize(tif);
|
strip_size = TIFFStripSize(tif);
|
||||||
rowStride = ((OPJ_SIZE_T)width * numcomps * (OPJ_SIZE_T)bps + 7U) / 8U;
|
rowStride = ((OPJ_SIZE_T)width * numcomps * (OPJ_SIZE_T)bps + 7U) / 8U;
|
||||||
if (rowStride != (OPJ_SIZE_T)strip_size) {
|
if (rowStride != (OPJ_SIZE_T)strip_size) {
|
||||||
|
|
|
@ -1359,12 +1359,10 @@ int main(int argc, char **argv)
|
||||||
if(image->color_space == OPJ_CLRSPC_SYCC){
|
if(image->color_space == OPJ_CLRSPC_SYCC){
|
||||||
color_sycc_to_rgb(image);
|
color_sycc_to_rgb(image);
|
||||||
}
|
}
|
||||||
else
|
else if((image->color_space == OPJ_CLRSPC_CMYK) && (parameters.cod_format != TIF_DFMT)){
|
||||||
if(image->color_space == OPJ_CLRSPC_CMYK){
|
|
||||||
color_cmyk_to_rgb(image);
|
color_cmyk_to_rgb(image);
|
||||||
}
|
}
|
||||||
else
|
else if(image->color_space == OPJ_CLRSPC_EYCC){
|
||||||
if(image->color_space == OPJ_CLRSPC_EYCC){
|
|
||||||
color_esycc_to_rgb(image);
|
color_esycc_to_rgb(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue