Oliver Rauch wrote: > Now I am trying to find out how to create color corrected RGB postscript > files. I looked through the lcms mailing list and found some information in > the message > http://sourceforge.net/mailarchive/message.php?msg_id=5763412 > > In the moment I try to create color corrected postscript files by hand at > first: > > 1) I create a CSA with > icc2ps -i scanner.ICM > scanner.CSA > > 2) I create the CRD with > icc2ps -o printer.ICM > printer.CRD > > 3) I have a scanned image that is saved as (non color corrected) RGB > postscript: image.ps > > now I try to create a color corrected postscript by concatening: > > file "printer.CRD" > line "<< /UseCIEColor true >> setpagedevice" > file "scanner.CSA" > file "image.ps" > line "/DefaultRGB exch /ColorSpace defineresource setcolorspace" > (this is IMAGE A) > > but the message above explains it a bit different (but may be there has > changed something in lcms since then): > > file "printer.CRD" > remove "/Current exch /ColorRendering defineresource pop" > (or create CRD with icc2ps -u) > add "setcolorrendering" > line "<< /UseCIEColor true >> setpagedevice" > file "scanner.CSA" > file "image.ps" > line "/DefaultRGB exch /ColorSpace defineresource setcolorspace" > (this is IMAGE B)
Hi Oliver, DefaultRGB and UseCIEColor are basically intended for printing documents, which don't use device independent color spaces and which specify colors in DeviceRGB (or DeviceCMYK) color space. Many applications are not color management aware and produce just DeviceRGB PS files. So when you print such a document, then DefaultRGB and UseCIEColor give you later, at printing time, the opportunitly to assign a particular interpretation to the DeviceRGB colors in the document. But if you create a new PS file anyway, then I would possibly tend to specify the image directly in its native, device independent colorspace (and not to use the indirection via UseCIEColor). E.g. [ /CIEBased... ...contents of CSA... ] setcolorspace << ...image dictionary.. >> image Note that the single operand (dictionary) version of the "image" operator needs to be used to specify images in CIEBased color spaces (and _not_ the 5 operand version, and also _not_ the "colorimage" operator). If you nevertheless want to use UseCIEColor and change the Default<XXX> resources, do it with global memory allocation enabled, e.g. currentglobal true setglobal % use sRGB color space for DefaultGray and DefaultRGB /DefaultGray [ /CIEBasedA << /DecodeLMN [ { dup 0.03928 le {12.92321 div} {0.055 add 1.055 div 2.4 exp} ifelse } bind dup dup ] /MatrixLMN [0.4123907993 0.2126390059 0.0193308187 0.3575843394 0.7151686788 0.1191947798 0.1804807884 0.0721923154 0.9505321522] /WhitePoint [0.9504559271 1.0 1.0890577508] >> ] /ColorSpace defineresource pop /DefaultRGB [ /CIEBasedABC << /DecodeLMN [ { dup 0.03928 le {12.92321 div} {0.055 add 1.055 div 2.4 exp} ifelse } bind dup dup ] /MatrixLMN [0.4123907993 0.2126390059 0.0193308187 0.3575843394 0.7151686788 0.1191947798 0.1804807884 0.0721923154 0.9505321522] /WhitePoint [0.9504559271 1.0 1.0890577508] >> ] /ColorSpace defineresource pop setglobal << /UseCIEColor true >> setpagedevice otherwise you may get trouble, at least with some versions of ghostscript. On the other hand, also don't call setpagedevice with global allocation enabled, or you'll get trouble too with ghostscript. > I do not have a color printer to test the result, so I tried to display the > results on my screen: > > - display (imagemagick) does not show any color corrections at all > > - kghostview shows the original (untouched) image but does not produce any > output for the files with CSA+CRD included > > - gimp and "gs -sDEVICE=x11" show changes in the colors with CSA+CRD included, > but the images A and B look different and I can not decide on the screen > which > one is the correct one. > > Question 1: What is the correct way to create a postscript file with CSA+CRD? There is not just a single possible way. For instance: % specify the image in a device independent CS << ...CRD contents ...>> setcolorrendering [ /CIEBased... ...contents of CSA... ] setcolorspace << ...image dictionary.. >> image ... showpage or % remap DeviceRGB to a CIEBased CS and % specify the image in DeviceRGB CS currentglobal true setglobal /DefaultRGB [ /CIEBased... ...CSA contents... ] /ColorSpace defineresource pop setglobal << /UseCIEColor true >> setpagedevice << ...CRD contents... >> setcolorrendering ...image operands... colorimage ... showpage or etc. > > > Question 2: How Do I produce a device independent postscipt file with an > included CSA but without a CRD? Is it done this way:? See above. > line "<< /UseCIEColor true >> setpagedevice" > file "scanner.CSA" > file "image.ps" > line "/DefaultRGB exch /ColorSpace defineresource setcolorspace" > > The postscript headers have to be moved to the top of the file I think. > > > Question 3: (a bit OT, but may be you know): When I want xsane to transfer > the > postscript directly to the printer should I always prepend the CRD to the > postscript file or does a real postscript printer know his CRD and the CRD > should only be prepended for ghostscript? (or should the ghostscript/printer > deamon prepend the CRD?) A "better" PS printer or RIP should know its CRD (or even an ICC profile instead of the CRD). Note, a PS document is no longer device independent, if it includes a CRD. IMO, printer drivers/backends which accept PostScript and which do the rendering via ghostscript should supply an appropriate CRD for the printer too, but I think that currently only a minority of them really does. > Question 4: Is it good to store the image in RGB or should I convert it to > CMYK before saving it as postscript? The following likely doesn't apply to e.g. professional RIPs, but at least ghostscript's color conversion via CSA/CRD is not as accurate as the conversion with ICC-based CMMs (e.g. via the lcms engine). Especially GS 7.xx gave unsatisfactory results (banding, etc.); the current 8.5x version work significantly better now, but a small quality difference to a conversion with an ICC-based CMM is IMO still noticeable. From this point of view it may indeed make sense to convert directly to the printer's native DeviceCMYK or DeviceRGB color space (depending on the printer's/driver's process color model) in the application, and to send the resulting DeviceCMYK or DeviceRGB image to the printer. This requires however that an ICC profile for the printer's colorspace is available to the application, and the resulting PS file is of course device dependent in this case. > Question 5: When I want to put images that are scanned with different > scanners > into one postscript file how do I apply different CSA to the different > images? For instance: [ /CIEBased... ...contents of CSA1... ] setcolorspace << ...image1 dictionary.. >> image ... [ /CIEBased... ...contents of CSA2... ] setcolorspace << ...image2 dictionary.. >> image > This way?: > > "<< /UseCIEColor true >> setpagedevice" > CSA1 > line "/DefaultRGB exch /ColorSpace defineresource setcolorspace" > image1 > CSA2 > line "/DefaultRGB exch /ColorSpace defineresource setcolorspace" > image2 Regards, Gerhard ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user