Merge branch 'master' of github.com:jcupitt/libvips

Conflicts:
	ChangeLog
This commit is contained in:
John Cupitt 2015-01-19 22:03:05 +00:00
commit 23071d73ac
2 changed files with 28 additions and 4 deletions

View File

@ -10,6 +10,7 @@
bindings
- vipsthumbnail will return an error code if one or more conversions failed
- disable chroma subsample in jpeg-tiff if Q >= 90
- try to handle tiffs with old-style 8-bit colormaps
24/12/14 started 7.42.1
- add gobject-2.0 to Requires: in vips and vips-cpp .pc files

View File

@ -152,6 +152,8 @@
* - better istiff detector spots bigtiff
* 3/12/14
* - read any XMP metadata
* 19/1/15
* - try to handle 8-bit colormaps
*/
/*
@ -853,10 +855,31 @@ parse_palette( ReadTiff *rtiff, VipsImage *out )
vips_error( "tiff2vips", "%s", _( "bad colormap" ) );
return( -1 );
}
for( i = 0; i < len; i++ ) {
read->red8[i] = read->red16[i] >> 8;
read->green8[i] = read->green16[i] >> 8;
read->blue8[i] = read->blue16[i] >> 8;
/* Old-style colourmaps were 8-bit. If all the top bytes are zero,
* assume we have one of these.
*
* See: https://github.com/jcupitt/libvips/issues/220
*/
for( i = 0; i < len; i++ )
if( (read->red16[i] >> 8) |
(read->green16[i] >> 8) |
(read->blue16[i] >> 8) )
break;
if( i < len )
for( i = 0; i < len; i++ ) {
read->red8[i] = read->red16[i] >> 8;
read->green8[i] = read->green16[i] >> 8;
read->blue8[i] = read->blue16[i] >> 8;
}
else {
vips_warn( "tiff2vips", "%s", _( "assuming 8-bit palette" ) );
for( i = 0; i < len; i++ ) {
read->red8[i] = read->red16[i] & 0xff;
read->green8[i] = read->green16[i] & 0xff;
read->blue8[i] = read->blue16[i] & 0xff;
}
}
/* Are all the maps equal? We have a mono image.