diff --git a/libvips/foreign/vipspng.c b/libvips/foreign/vipspng.c index 30eec403..abd477c2 100644 --- a/libvips/foreign/vipspng.c +++ b/libvips/foreign/vipspng.c @@ -471,6 +471,15 @@ png2vips_header( Read *read, VipsImage *out ) VIPS_META_ICC_NAME, profile, proflen ); } + /* Some libpng warn you to call png_set_interlace_handling(); here, but + * that can actually break interlace on older libpngs. + * + * Only set this for libpng 1.6+. + */ +#if PNG_LIBPNG_VER > 10600 + (void) png_set_interlace_handling( read->pPng ); +#endif + /* Sanity-check line size. */ png_read_update_info( read->pPng, read->pInfo ); @@ -541,15 +550,6 @@ png2vips_interlace( Read *read, VipsImage *out ) if( setjmp( png_jmpbuf( read->pPng ) ) ) return( -1 ); - /* Some libpng warn you to call png_set_interlace_handling(); here, but - * that can actually break interlace on older libpngs. - * - * Only set this for libpng 1.6+. - */ -#if PNG_LIBPNG_VER > 10600 - (void) png_set_interlace_handling( read->pPng ); -#endif - if( !(read->row_pointer = VIPS_ARRAY( NULL, out->Ysize, png_bytep )) ) return( -1 ); for( y = 0; y < out->Ysize; y++ )