Fix black channel overwrite in XZY2CMYK.c

This commit is contained in:
Dimitri Bouron 2019-01-16 19:04:41 +01:00
parent 8ded32ac20
commit 5f61727253
2 changed files with 6 additions and 5 deletions

View File

@ -151,8 +151,6 @@ vips_XYZ2CMYK_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
float g = p[1] / VIPS_D65_Y0;
float b = p[2] / VIPS_D65_Z0;
if (r < epsilon && g < epsilon && b < epsilon)
q[3] = 255.0;
c = 255.0 - r;
m = 255.0 - g;
y = 255.0 - b;
@ -166,6 +164,9 @@ vips_XYZ2CMYK_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
q[0] = (unsigned char) VIPS_CLIP(0, c, 255.0);
q[1] = (unsigned char) VIPS_CLIP(0, m, 255.0);
q[2] = (unsigned char) VIPS_CLIP(0, y, 255.0);
if (r < epsilon && g < epsilon && b < epsilon)
q[3] = 255.0;
else
q[3] = (unsigned char) VIPS_CLIP(0, k, 255.0);
p += 3;