diff --git a/ChangeLog b/ChangeLog index 92cf8fb2..772a8a14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ 8/9/14 started 7.40.9 - support jfif resunit "none" +- support GRAY as an input and output ICC space +- fix a read loop with setjmp() in png read, if the png file is broken 8/9/14 started 7.40.8 - fix configure on rhel6 [Lovell] diff --git a/libvips/colour/icc_transform.c b/libvips/colour/icc_transform.c index 65d73a5d..9aa22c6c 100644 --- a/libvips/colour/icc_transform.c +++ b/libvips/colour/icc_transform.c @@ -26,6 +26,8 @@ * - import and export would segv on very wide images * 12/11/13 * - support XYZ as an alternative PCS + * 10/9/14 + * - support GRAY as an input and output space */ /* @@ -245,6 +247,18 @@ vips_icc_build( VipsObject *object ) TYPE_RGB_16 : TYPE_RGB_8; break; +#ifdef HAVE_LCMS2 + case cmsSigGrayData: + code->input_bands = 1; + code->input_format = + code->in->BandFmt == VIPS_FORMAT_USHORT ? + VIPS_FORMAT_USHORT : VIPS_FORMAT_UCHAR; + icc->in_icc_format = + code->in->BandFmt == VIPS_FORMAT_USHORT ? + TYPE_GRAY_16 : TYPE_GRAY_8; + break; +#endif /*HAVE_LCMS2*/ + case cmsSigCmykData: code->input_bands = 4; code->input_format = @@ -266,8 +280,6 @@ vips_icc_build( VipsObject *object ) case cmsSigXYZData: code->input_bands = 3; code->input_format = VIPS_FORMAT_FLOAT; - code->input_interpretation = - VIPS_INTERPRETATION_XYZ; icc->in_icc_format = TYPE_XYZ_16; break; @@ -295,6 +307,22 @@ vips_icc_build( VipsObject *object ) TYPE_RGB_16 : TYPE_RGB_8; break; +#ifdef HAVE_LCMS2 + case cmsSigGrayData: + colour->interpretation = + icc->depth == 8 ? + VIPS_INTERPRETATION_B_W : + VIPS_INTERPRETATION_GREY16; + colour->format = + icc->depth == 8 ? + VIPS_FORMAT_UCHAR : VIPS_FORMAT_USHORT; + colour->bands = 1; + icc->out_icc_format = + icc->depth == 16 ? + TYPE_GRAY_16 : TYPE_GRAY_8; + break; +#endif /*HAVE_LCMS2*/ + case cmsSigCmykData: colour->interpretation = VIPS_INTERPRETATION_CMYK; colour->format = diff --git a/libvips/foreign/vipspng.c b/libvips/foreign/vipspng.c index 551a976e..4ef44cfc 100644 --- a/libvips/foreign/vipspng.c +++ b/libvips/foreign/vipspng.c @@ -509,6 +509,11 @@ png2vips_generate( VipsRegion *or, read->y_pos += 1; } + /* Turn errors back on. png_read_end() can trigger them too. + */ + if( setjmp( png_jmpbuf( read->pPng ) ) ) + return( -1 ); + /* We need to shut down the reader immediately at the end of read or * we won't detach ready for the next image. */