Poppler incorrectly renders CMYK colors
Submitted by Troy Henderson
Assigned to poppler-bugs
Description
Created attachment 14361 Example of incorrect rendering
It seems that poppler is incorrectly rendering CMYK colors. Specifically, the attachment is a picture of a cyan (1,0,0,0) filled color which should convert to RGB (0,1,1) but is being converted incorrectly to (0,0.67,0.93).
The file GfxState.cc seems to be the culprit. I changed this file by editing the function to contain (sorry but I don't know how to write patches)
void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { double c, m, y, k, k1, r, g, b;
c = colToDbl(color->c[0]);
m = colToDbl(color->c[1]);
y = colToDbl(color->c[2]);
k = colToDbl(color->c[3]);
k1 = 1 - k;
r = (1-c)*k1;
g = (1-m)*k1;
b = (1-y)*k1;
rgb->r = clip01(dblToCol(r));
rgb->g = clip01(dblToCol(g));
rgb->b = clip01(dblToCol(b));
}
After changing this function to this, everything seems to work as normal.
Attachment 14361, "Example of incorrect rendering":
preview.pdf