small reformats

plus remove save multiband as separated multiink
This commit is contained in:
John Cupitt 2019-12-07 17:41:53 +00:00
parent 22a1150cb6
commit 40bffa8cc6
2 changed files with 28 additions and 38 deletions

View File

@ -1354,19 +1354,14 @@ rtiff_parse_copy( Rtiff *rtiff, VipsImage *out )
else
out->Type = VIPS_INTERPRETATION_sRGB;
}
if( samples_per_pixel >= 3 &&
else if( samples_per_pixel >= 3 &&
photometric_interpretation == PHOTOMETRIC_CIELAB )
out->Type = VIPS_INTERPRETATION_LAB;
if( samples_per_pixel >= 4 &&
photometric_interpretation == PHOTOMETRIC_SEPARATED &&
inkset == INKSET_CMYK)
else if( photometric_interpretation == PHOTOMETRIC_SEPARATED &&
samples_per_pixel >= 4 &&
inkset == INKSET_CMYK )
out->Type = VIPS_INTERPRETATION_CMYK;
if (samples_per_pixel >= 1 &&
photometric_interpretation == PHOTOMETRIC_SEPARATED &&
inkset == INKSET_MULTIINK)
else
out->Type = VIPS_INTERPRETATION_MULTIBAND;
rtiff->sfn = rtiff_memcpy_line;
@ -2176,17 +2171,17 @@ rtiff_header_read( Rtiff *rtiff, RtiffHeader *header )
uint16 extra_samples_count;
uint16 *extra_samples_types;
if( !tfget32( rtiff->tiff, TIFFTAG_IMAGEWIDTH, &header->width ) ||
!tfget32( rtiff->tiff, TIFFTAG_IMAGELENGTH, &header->height ) ||
!tfget16( rtiff->tiff,
TIFFTAG_SAMPLESPERPIXEL, &header->samples_per_pixel ) ||
!tfget16( rtiff->tiff,
TIFFTAG_BITSPERSAMPLE, &header->bits_per_sample ) ||
!tfget16( rtiff->tiff,
TIFFTAG_PHOTOMETRIC,
if( !tfget32( rtiff->tiff, TIFFTAG_IMAGEWIDTH,
&header->width ) ||
!tfget32( rtiff->tiff, TIFFTAG_IMAGELENGTH,
&header->height ) ||
!tfget16( rtiff->tiff, TIFFTAG_SAMPLESPERPIXEL,
&header->samples_per_pixel ) ||
!tfget16( rtiff->tiff, TIFFTAG_BITSPERSAMPLE,
&header->bits_per_sample ) ||
!tfget16( rtiff->tiff, TIFFTAG_PHOTOMETRIC,
&header->photometric_interpretation ) ||
!tfget16(rtiff->tiff,
TIFFTAG_INKSET,
!tfget16( rtiff->tiff, TIFFTAG_INKSET,
&header->inkset ) )
return( -1 );

View File

@ -654,9 +654,11 @@ wtiff_write_header( Wtiff *wtiff, Layer *layer )
TIFFSetField( tif, TIFFTAG_BITSPERSAMPLE,
vips_format_sizeof( wtiff->im->BandFmt ) << 3 );
if (wtiff->im->Type == VIPS_INTERPRETATION_B_W ||
wtiff->im->Type == VIPS_INTERPRETATION_GREY16) {
// Mono or mono + alpha.
if( wtiff->im->Type == VIPS_INTERPRETATION_B_W ||
wtiff->im->Type == VIPS_INTERPRETATION_GREY16 ||
wtiff->im->Bands < 3 ) {
/* Mono or mono + alpha.
*/
photometric = wtiff->miniswhite ?
PHOTOMETRIC_MINISWHITE :
PHOTOMETRIC_MINISBLACK;
@ -670,14 +672,7 @@ wtiff_write_header( Wtiff *wtiff, Layer *layer )
else if( wtiff->im->Type == VIPS_INTERPRETATION_CMYK &&
wtiff->im->Bands >= 4 ) {
photometric = PHOTOMETRIC_SEPARATED;
TIFFSetField( tif,
TIFFTAG_INKSET, INKSET_CMYK );
colour_bands = 4;
}
else if (wtiff->im->Type == VIPS_INTERPRETATION_MULTIBAND ) {
photometric = PHOTOMETRIC_SEPARATED;
TIFFSetField(tif,
TIFFTAG_INKSET, INKSET_MULTIINK);
TIFFSetField( tif, TIFFTAG_INKSET, INKSET_CMYK );
colour_bands = 4;
}
else if( wtiff->compression == COMPRESSION_JPEG &&
@ -685,19 +680,19 @@ wtiff_write_header( Wtiff *wtiff, Layer *layer )
wtiff->im->BandFmt == VIPS_FORMAT_UCHAR &&
(!wtiff->rgbjpeg && wtiff->Q < 90) ) {
/* This signals to libjpeg that it can do
* YCbCr chrominance subsampling from RGB, not
* that we will supply the image as YCbCr.
*/
* YCbCr chrominance subsampling from RGB, not
* that we will supply the image as YCbCr.
*/
photometric = PHOTOMETRIC_YCBCR;
TIFFSetField( tif, TIFFTAG_JPEGCOLORMODE,
JPEGCOLORMODE_RGB );
colour_bands = 3;
}
else {
/* Some kind of generic multi-band image ..
* save the first three bands as RGB, the rest
* as alpha.
*/
/* Some kind of generic multi-band image with three or
* more bands ... save the first three bands as RGB,
* the rest as alpha.
*/
photometric = PHOTOMETRIC_RGB;
colour_bands = 3;
}