mm2 / Little-CMS

A free, open source, CMM engine. It provides fast transforms between ICC profiles.
https://www.littlecms.com
MIT License
571 stars 176 forks source link

Postscript creation code sometimes unusable #402

Closed EskoJan closed 1 year ago

EskoJan commented 1 year ago

Hi,

I recently started using LittleCMS to create postscript code for ICC based colorspaces - cmsGetPostScriptColorResource API. I noticed the postscript code creating the /DecodeA(BC) is based on postscript variables and immediate variable replacement: 'lcms2gammaproc' and 'lcms2gammatable' variables are used to store intermediate results. This produces corrupt postscript if embedded in a PaintProc or any other PostScript procedure. I've attached two postscript files: one created using LittleCMS 2.15 using the intermediate variables, and one created with LittleCMS 2.8 which does not use these variables. Sending the first to Apple Preview or Adobe Distiller results in an error on 'lcms2gammatable'. My PostScript is a little rusty, but I think what happens is that PS procedures, such as PaintProc, are not handled by the PS Interpreter until they are invoked. That means that the lcms2gammatable variable does not get defined in the current dictionary so it is unavailable for immediate variable replacement in lcms2gammaproc.

I have an obvious workaround, which is to use LittleCMS 2.8 instead of 2.15. But I was hoping for a fix in the latest version. Any chance of getting this in there?

br, Jan.

Sample postscript files.zip

mm2 commented 1 year ago

Hello and thanks for let me know. Those names come from a PR that I approved without doing a proper review and have been a source of complains since then. Now I'm quite convinced those names adds nothing but unwanted complexity and issues. I am going to revert the PR back to the 2.8, but I will first make sure I am not destroying any wide used package. Will solve in a way or another soon. Thanks again.

EskoJan commented 1 year ago

Thanks for getting back to me so quickly, happy to hear your conclusion.