fix thumbnail of mono image

we were using RGB as the shrink space
This commit is contained in:
John Cupitt 2020-05-27 15:24:27 +01:00
parent 474bfe3782
commit aaebb3b346
2 changed files with 14 additions and 4 deletions

View File

@ -628,6 +628,11 @@ wtiff_write_header( Wtiff *wtiff, Layer *layer )
int orientation;
#ifdef DEBUG
printf( "wtiff_write_header: sub %d, width %d, height %d\n",
layer->sub, layer->width, layer->height );
#endif /*DEBUG*/
/* Output base header fields.
*/
TIFFSetField( tif, TIFFTAG_IMAGEWIDTH, layer->width );
@ -1699,10 +1704,10 @@ write_strip( VipsRegion *region, VipsRect *area, void *a )
Wtiff *wtiff = (Wtiff *) a;
Layer *layer = wtiff->layer;
#ifdef DEBUG
#ifdef DEBUG_VERBOSE
printf( "write_strip: strip at %d, height %d\n",
area->top, area->height );
#endif/*DEBUG*/
#endif/*DEBUG_VERBOSE*/
for(;;) {
VipsRect *to = &layer->strip->valid;

View File

@ -524,13 +524,12 @@ vips_thumbnail_build( VipsObject *object )
{
VipsThumbnail *thumbnail = VIPS_THUMBNAIL( object );
VipsImage **t = (VipsImage **) vips_object_local_array( object, 15 );
VipsInterpretation interpretation = thumbnail->linear ?
VIPS_INTERPRETATION_scRGB : VIPS_INTERPRETATION_sRGB;
VipsImage *in;
int preshrunk_page_height;
double hshrink;
double vshrink;
VipsInterpretation interpretation;
/* TRUE if we've done the import of an ICC transform and still need to
* export.
@ -628,6 +627,12 @@ vips_thumbnail_build( VipsObject *object )
*/
if( in->Type == VIPS_INTERPRETATION_CMYK )
have_imported = TRUE;
if( thumbnail->linear )
interpretation = VIPS_INTERPRETATION_scRGB;
else if( in->Bands < 3 )
interpretation = VIPS_INTERPRETATION_B_W;
else
interpretation = VIPS_INTERPRETATION_sRGB;
g_info( "converting to processing space %s",
vips_enum_nick( VIPS_TYPE_INTERPRETATION, interpretation ) );
if( vips_colourspace( in, &t[2], interpretation, NULL ) )