support GRAY as an input and output ICC space

see

https://github.com/jcupitt/libvips/issues/176
This commit is contained in:
John Cupitt 2014-09-10 09:37:13 +01:00
parent 8875e23128
commit 01bd7cad04
2 changed files with 28 additions and 2 deletions

View File

@ -1,5 +1,7 @@
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]

View File

@ -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,16 @@ vips_icc_build( VipsObject *object )
TYPE_RGB_16 : TYPE_RGB_8;
break;
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;
case cmsSigCmykData:
code->input_bands = 4;
code->input_format =
@ -266,8 +278,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 +305,20 @@ vips_icc_build( VipsObject *object )
TYPE_RGB_16 : TYPE_RGB_8;
break;
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;
case cmsSigCmykData:
colour->interpretation = VIPS_INTERPRETATION_CMYK;
colour->format =