Bug 695407 - tiffsep should print out separation equivalent CMYK
Summary: tiffsep should print out separation equivalent CMYK
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Other Driver (show other bugs)
Version: master
Hardware: All All
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-04 13:10 UTC by mlen
Modified: 2014-08-08 02:08 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
Patch for tiffsep device (2.31 KB, patch)
2014-08-04 13:12 UTC, mlen
Details | Diff
Patch with the changes noted in the comment (5.12 KB, patch)
2014-08-05 11:29 UTC, Ken Sharp
Details | Diff
Modified patch (5.11 KB, patch)
2014-08-06 00:36 UTC, Ken Sharp
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mlen 2014-08-04 13:10:33 UTC
Attached patch makes ghostscript print out equivalent CMYK values for when processing files using tiffsep device.

Added output is printed out in the following format:

%%SeparationColor: C M Y K Name

where C, M, Y and K are raw 16bit colorant values and Name is the separation name.

Example output:

%%SeparationColor: 32760 0 0 0 Cyan
%%SeparationColor: 0 32760 0 0 Magenta
%%SeparationColor: 0 0 32760 0 Yellow
%%SeparationColor: 0 0 0 32760 Black
%%SeparationColor: 6552 0 0 0 Transparent
%%SeparationColor: 23915 327 31449 1310 PANTONE 369 C
%%SeparationColor: 0 0 0 32760 Black Line
%%SeparationColor: 0 32760 32760 0 Keyline
%%SeparationColor: 0 327 0 0 White
%%SeparationColor: 0 0 0 32760 Template
Comment 1 mlen 2014-08-04 13:12:38 UTC
Created attachment 11094 [details]
Patch for tiffsep device
Comment 2 Ken Sharp 2014-08-04 13:30:56 UTC
Hmm, if the original separation was not specified as CMYK (and perhaps even if it was) then the CMYK equivalents are not strictly 'correct'. I'm not certain (this is one for Michael) but I assume the CMYK values will have been produced by littleCMS and so will not be the ones in the original input file.

In the case of ICCBased PDF input, the CMYK equivalents for a Separation or DeviceN will definitely depend on the colour management.

I'm also uncertain about sticking random data into a TIFF file. I've had a quick peruse of the TIFF 6.0 spec, and while its certainly possible to pack extraneous data between the tags and image data in a TIFF file, I'm not certain this is 100% legal and may potentially confuse TIFF readers.

I'm assuming this is being used to 'colorise' the TIFF output, that is to convert the grayscale image into a CMYK image, presumably for proofing purposes.

I'd like to hear some opinions from other staff before we decide whether to adopt this patch. Also, who owns the tiffsep device anyway ?
Comment 3 Ken Sharp 2014-08-05 08:07:07 UTC
Consulting during the Tuesday meeting. I misunderstood the patch, and the colour equivalents are going to stdout, not to the TIFF file. Personally I'd like to see this controlled by a device parameter to avoid people getting output on stdout they aren't expecting.

The CMYK values are the tint transform values when the alternate space is CMYK, they may be colour managed when the alternate is some other space (Gray or RGB), hoping to hear back from Michael about this. I'd like to see a comment added to the code when we know for sure, just because someone will ask one day.....
Comment 4 Ken Sharp 2014-08-05 11:29:23 UTC
Created attachment 11095 [details]
Patch with the changes noted in the comment

When I run this with a test file of my own it prints the separation name as 'Cyan' which is incorrect. This is because num_comp is 1. It looks like the code in print_cmyk_equivalent_colors isn't sophisticated enough to deal with PostScript files which only have Separation colours and not CMYK. I've changed the code to deal with that.

I also changed stpcpy to strcpy and moved the definition of int_num to the head of the function out of the body, as this won't compile properly on some platforms otherwise.

I added a comment to print_cmyk_equivalent_colors with the information Micahel provided about where the CYK values are derived from.

Finally I added a new device parameter PrintSpotTransforms which defaults to false, if true it prints the CMYK values just as before. Checked with a release build to ensure no problems were found, and cluster tested.

It would be useful if someone could cast an eye over this.
Comment 5 Ray Johnston 2014-08-05 13:32:31 UTC
Thanks, Ken, I'll have a look. From your comments, I think "PrintSpotTransforms"
is not as clear as "PrintSpotCMYKtint" or "PrintSpotCMYKequiv", or just the
simple "PrintSpotCMYK" -- Transforms doesn't make much sense unless one knows
about the "Tint Transform" in the spec.

My gripe with the original was the unclear output, eg:
   %%SeparationColor: 23915 327 31449 1310 PANTONE 369 C
instead of something like:

    %%SeparationColor: "PANTONE 369 C" CMYK equiv: [23915 327 31449 1310]

Both can be parsed readily, but mine is more human friendly (which since I
am one -- at least until late at night -- I prefer).
Comment 6 Ken Sharp 2014-08-05 13:59:55 UTC
(In reply to Ray Johnston from comment #5)
> Thanks, Ken, I'll have a look. From your comments, I think
> "PrintSpotTransforms"
> is not as clear as "PrintSpotCMYKtint" or "PrintSpotCMYKequiv", or just the
> simple "PrintSpotCMYK"

I was trying to keep the name short and relatively easy to type, I didn't like the abbreviation of equiv, and equivalent was just too long and hard to type right.

PrintSpotCMYK would be OK by me if you prefer that.


> My gripe with the original was the unclear output, eg:
>    %%SeparationColor: 23915 327 31449 1310 PANTONE 369 C
> instead of something like:
> 
>     %%SeparationColor: "PANTONE 369 C" CMYK equiv: [23915 327 31449 1310]
> 
> Both can be parsed readily, but mine is more human friendly (which since I
> am one -- at least until late at night -- I prefer).

Yeah I thought about changing that, it made more sense from my POV to have the ink name follow the SeparationColor: comment, as you have it above. I'm happy for you to change it that way if you want to do it, would be nice to hear from mlen here also.

We also need to know if mlen has completed a CLA.
Comment 7 Ken Sharp 2014-08-06 00:36:32 UTC
Created attachment 11096 [details]
Modified patch

OK so further to Ray's comments. The switch is now PrintSpotCMYK and the output is of the form 

%%SeparationColor: "ink name" 100% ink = %d %d %d %d CMYK

So we see the ink name more easily, and the description includes the fact that 100% of the spot colour maps to a given CMYK value.

This also fixes a bug in the previous patch (which nobody noticed!) causing all the CMYK values to be wrong.

mlen I need to know if this format of output is suitable for you. It would be helpful also if at least one person would test this.
Comment 8 Ken Sharp 2014-08-08 02:08:24 UTC
Patch committed in 3a035a2a9e94196920f99a18670ee96202f67bb9