Bug 697965

Summary: CMY output device produces incorrect color
Product: Ghostscript Reporter: ylai
Component: ColorAssignee: Robin Watts <robin.watts>
Status: IN_PROGRESS ---    
Severity: enhancement CC: ghostpdl-bugs
Priority: P4    
Version: master   
Hardware: PC   
OS: All   
Customer: Word Size: ---
Attachments: Patch for handling CMY color space

Description ylai 2017-05-30 02:33:35 UTC
Created attachment 13727 [details]
Patch for handling CMY color space

CMY output device (e.g. dye sublimation printer with cupsColorSpace=4) with the CMY colors (e.g. via PostScript setcmykcolor) produce incorrect color with -dUseFastColor=false (due to lack of profile and mistaking three channel CMY color space to be RGB), and inverted color with -dUseFastColor=true (also due to mistaking CMY color space to be RGB).

Only RGB color input result in approximately sensible output, as they are passed as RGB values internally, converted into CMYK using the default ICC profile, and then with the K values added back to C, M, Y.

Not most debilitating consequence is, with Ghostscript 9.x, it became impossible to produce profiling targets for CMY output devices (i.e. with -dUseFastColor=true).

In order to pass through the CMY color space information properly, various functions in gsicc*.c and gxcmap.c needs to test for dev->color_info.polarity before assuming a three channel color space is RGB. Then the function cmap_cmyk_direct also needs to handle dev_proc(dev, get_color_comp_index) returning -1 for "Black".
Comment 1 Michael Vrhel 2017-09-21 12:26:10 UTC
OK.  I can understand the need for the direct printing of CMY for profiling.  I will review this patch.
Comment 2 Michael Vrhel 2019-01-03 23:56:29 UTC
So I am changing this to an enhancement.  There are potential issues that I can see mainly related to transparency and color management with the solution that the reporter has given.  There are probably several places in the code where we do testing for number of channels equal to three and assume that it is an RGB model.   I think what I will do is create a psdcmy device which will be a cmy planar output device that would be useful to have as an example that people can see and emulate if they want.