enable separated/multiband load and save for tiff format
This commit is contained in:
parent
da8ae29abe
commit
fa0514a4d4
|
@ -250,6 +250,7 @@ typedef struct _RtiffHeader {
|
||||||
int samples_per_pixel;
|
int samples_per_pixel;
|
||||||
int bits_per_sample;
|
int bits_per_sample;
|
||||||
int photometric_interpretation;
|
int photometric_interpretation;
|
||||||
|
int inkset;
|
||||||
int sample_format;
|
int sample_format;
|
||||||
gboolean separate;
|
gboolean separate;
|
||||||
int orientation;
|
int orientation;
|
||||||
|
@ -1310,6 +1311,7 @@ rtiff_parse_copy( Rtiff *rtiff, VipsImage *out )
|
||||||
int samples_per_pixel = rtiff->header.samples_per_pixel;
|
int samples_per_pixel = rtiff->header.samples_per_pixel;
|
||||||
int photometric_interpretation =
|
int photometric_interpretation =
|
||||||
rtiff->header.photometric_interpretation;
|
rtiff->header.photometric_interpretation;
|
||||||
|
int inkset = rtiff->header.inkset;
|
||||||
|
|
||||||
if( rtiff_non_fractional( rtiff ) )
|
if( rtiff_non_fractional( rtiff ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
@ -1339,9 +1341,15 @@ rtiff_parse_copy( Rtiff *rtiff, VipsImage *out )
|
||||||
out->Type = VIPS_INTERPRETATION_LAB;
|
out->Type = VIPS_INTERPRETATION_LAB;
|
||||||
|
|
||||||
if( samples_per_pixel >= 4 &&
|
if( samples_per_pixel >= 4 &&
|
||||||
photometric_interpretation == PHOTOMETRIC_SEPARATED )
|
photometric_interpretation == PHOTOMETRIC_SEPARATED &&
|
||||||
|
inkset == INKSET_CMYK)
|
||||||
out->Type = VIPS_INTERPRETATION_CMYK;
|
out->Type = VIPS_INTERPRETATION_CMYK;
|
||||||
|
|
||||||
|
if (samples_per_pixel >= 1 &&
|
||||||
|
photometric_interpretation == PHOTOMETRIC_SEPARATED &&
|
||||||
|
inkset == INKSET_MULTIINK)
|
||||||
|
out->Type = VIPS_INTERPRETATION_MULTIBAND;
|
||||||
|
|
||||||
rtiff->sfn = rtiff_memcpy_line;
|
rtiff->sfn = rtiff_memcpy_line;
|
||||||
rtiff->client = out;
|
rtiff->client = out;
|
||||||
|
|
||||||
|
@ -2151,7 +2159,10 @@ rtiff_header_read( Rtiff *rtiff, RtiffHeader *header )
|
||||||
TIFFTAG_BITSPERSAMPLE, &header->bits_per_sample ) ||
|
TIFFTAG_BITSPERSAMPLE, &header->bits_per_sample ) ||
|
||||||
!tfget16( rtiff->tiff,
|
!tfget16( rtiff->tiff,
|
||||||
TIFFTAG_PHOTOMETRIC,
|
TIFFTAG_PHOTOMETRIC,
|
||||||
&header->photometric_interpretation ) )
|
&header->photometric_interpretation ) ||
|
||||||
|
!tfget16(rtiff->tiff,
|
||||||
|
TIFFTAG_INKSET,
|
||||||
|
&header->inkset ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
TIFFGetFieldDefaulted( rtiff->tiff,
|
TIFFGetFieldDefaulted( rtiff->tiff,
|
||||||
|
|
|
@ -677,6 +677,12 @@ wtiff_write_header( Wtiff *wtiff, Layer *layer )
|
||||||
TIFFTAG_INKSET, INKSET_CMYK );
|
TIFFTAG_INKSET, INKSET_CMYK );
|
||||||
colour_bands = 4;
|
colour_bands = 4;
|
||||||
}
|
}
|
||||||
|
else if (wtiff->im->Type == VIPS_INTERPRETATION_MULTIBAND ) {
|
||||||
|
photometric = PHOTOMETRIC_SEPARATED;
|
||||||
|
TIFFSetField(tif,
|
||||||
|
TIFFTAG_INKSET, INKSET_MULTIINK);
|
||||||
|
colour_bands = 4;
|
||||||
|
}
|
||||||
else if( wtiff->compression == COMPRESSION_JPEG &&
|
else if( wtiff->compression == COMPRESSION_JPEG &&
|
||||||
wtiff->im->Bands == 3 &&
|
wtiff->im->Bands == 3 &&
|
||||||
wtiff->im->BandFmt == VIPS_FORMAT_UCHAR &&
|
wtiff->im->BandFmt == VIPS_FORMAT_UCHAR &&
|
||||||
|
|
Loading…
Reference in New Issue