Bug 686797

Summary: Colors slightly off in PostScript file
Product: Ghostscript Reporter: Jack Moffitt <jack>
Component: PS InterpreterAssignee: Ray Johnston <ray.johnston>
Status: NOTIFIED FIXED    
Severity: enhancement    
Priority: P4    
Version: master   
Hardware: PC   
OS: All   
Customer: 651 Word Size: ---

Description Jack Moffitt 2003-04-01 08:57:35 UTC
The customer's file looks different when rendered by Ghostscript than the
correct image provided in the JPEG.  I just used:

gs MMuchaLuchaFortuneDonut\ c.eps

to see this.
Comment 1 Jack Moffitt 2003-04-01 08:58:15 UTC
Created attachment 53 [details]
MuchaLuchaFortuneDonut.jpg
Comment 2 Jack Moffitt 2003-04-01 09:24:30 UTC
Created attachment 54 [details]
eps.zip
Comment 3 Ray Johnston 2003-04-01 10:45:40 UTC
The file has an ICC input profile present as comments.

Some Adobe applications read this ICC profile (even though
PostScript doesn't support ICC profiles as PDF does).

If I manually convert the hex ICC profile data to binary
and use the profile (along with disabling the /DeviceCMYK
setcolorspace that the file performs) then I get the same
colors.

This is really a feature request for Artifex to implement
recoginition and loading of an ICC profile that is tagged
by a DSC comment header.
Comment 4 Raph Levien 2003-04-17 10:25:54 UTC
When we implement the capability of extracting ICC input profiles from the DSC
comment, we should also verify that these color spaces are correctly written by
the pdfwrite driver. This code already has the capability of embedding ICC
profiles to output PDF files.
Comment 5 Jack Moffitt 2003-04-17 10:45:06 UTC
Created attachment 90 [details]
cheerios.eps

This file is from a different customer.
Comment 6 Ray Johnston 2003-04-23 07:05:08 UTC
I've removed the 'bountiable' keyword since I got frustrated with other
tasks and took a few hours and implemented this. 

It will be committed shortly.
Comment 7 Ray Johnston 2003-04-23 11:52:38 UTC
Besides code to detect and load ICC profiles embedded in PostScript,
it may be that all that is needed is to do two things to get Ghostscript
to convert CMYK colors to what you (probably) expect:

1) If you are running Ghostscript 8.00 or later check to make sure that
   the following patch to lib/gs_init.ps has been applied:

diff -c -r1.87 gs_init.ps
*** lib/gs_init.ps      12 Apr 2003 18:08:18 -0000      1.87
--- lib/gs_init.ps      23 Apr 2003 18:33:16 -0000
***************
*** 1749,1754 ****
--- 1749,1763 ----
  put                           % Policies in pagedevice
  .setpagedevice
  %END MEDIA
+
+ % Set up the interpreter context version of -dUSeCIEColor option
+ % so that .getuseciecolor has the correct value (see gs_setpd.ps)
+ /setpagedevice where {
+   pop systemdict /UseCIEColor known {
+     mark /UseCIEColor UseCIEColor .dicttomark setpagedevice
+   } if
+ } if
+
  %END DISPLAYING

  (END DEVICE) VMDEBUG

2) set the -dUseCIEColor command line option. This will cause CMYK colors
   to go through the /DefaultCMYK ColorSpace conversion (actually installs
   a CIEBasedDEFG colorspace).


Note that if you don't want to apply the patch, you could also use the
following slightly more verbose command line option:

    -c "<< /UseCIEColor true >> setpagedevice " -f 

just before the input file to be converted.

If you want an even better (SWOP) based DefaultCMYK colorspace conversion,
I can provide one. This would replace the one in gs_ll3.ps
Comment 8 Ray Johnston 2003-04-23 23:29:35 UTC
Patches to lib/gs_icc.ps and lib/gs_pdfwr.ps committed to allow
processing of %%BeginICCProfile section.

NOTE: Only tested for CMYK profiles (which are the case for both
of these samples and one free user bug file).