diff --git a/ChangeLog b/ChangeLog index e81501d0..41d6dd9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ - better hasalpha rules - create funcs always make MULTIBAND (ie. no alpha) - use O_TMPFILE, if available [Alexander--] +- set "interlaced=1" for interlaced JPG and PNG images 12/3/18 started 8.6.4 - better fitting of fonts with overhanging edges, thanks AdriĆ  diff --git a/libvips/foreign/jpeg2vips.c b/libvips/foreign/jpeg2vips.c index ceed5918..a3320606 100644 --- a/libvips/foreign/jpeg2vips.c +++ b/libvips/foreign/jpeg2vips.c @@ -94,6 +94,8 @@ * - revert previous warning change: libvips reports serious corruption, * like a truncated file, as a warning and we need to be able to catch * that + * 9/4/18 + * - set interlaced=1 for interlaced images */ /* @@ -414,6 +416,11 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out ) (void) vips_image_set_int( out, "jpeg-multiscan", jpeg_has_multiple_scans( cinfo ) ); + /* 8.7 adds this for PNG as well, so we have a new format-neutral name. + */ + if( jpeg_has_multiple_scans( cinfo ) ) + vips_image_set_int( out, "interlaced", 1 ); + /* Look for EXIF and ICC profile. */ for( p = cinfo->marker_list; p; p = p->next ) { diff --git a/libvips/foreign/vipspng.c b/libvips/foreign/vipspng.c index a7aaf963..1a98000b 100644 --- a/libvips/foreign/vipspng.c +++ b/libvips/foreign/vipspng.c @@ -65,6 +65,8 @@ * - better behaviour for truncated png files, thanks Yury * 26/4/17 * - better @fail handling with truncated PNGs + * 9/4/18 + * - set interlaced=1 for interlaced images */ /* @@ -438,6 +440,11 @@ png2vips_header( Read *read, VipsImage *out ) return( -1 ); } + /* Let our caller know. These are very expensive to decode. + */ + if( interlace_type != PNG_INTERLACE_NONE ) + vips_image_set_int( out, "interlaced", 1 ); + return( 0 ); }