Re: How to do RGB to CMYK conversion for PS output? [message #49313] |
Thu, 13 July 2006 12:55  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Karl Schultz wrote:
> On Thu, 13 Jul 2006 14:31:22 -0400, Paul Van Delst wrote:
>
>
>> Hello there,
>>
>> A colleague produced a colour X-Y plot for a paper and saved it to a regular old PS file.
>> The editor mailed back stating that the file contains RGB colours and could we please
>> create the file in CMYK colours.
>>
>> How does one do this? Using
>> DEVICE,/CMYK
>> produced exactly the same PS file.
>>
>> Doing,
>> TVLCT,r,g,b,/GET
>> CMYK_CONVERT,c,m,y,k,r,g,b,/TO_CMYK
>> produced the appropriate c, m, y, and k arrays, but how does one "load" the CMYK arrays to
>> be used? Doing
>> TVLCT,c,m,y
>> produced exactly what I thought would happen - no black.
>>
>> Any ideas?
>
>
> Yes.
>
> Try:
>
> DEVICE, /CMYK, /COLOR
>
> You need to put the device into color mode when you select CMYK :-).
Yes, the /COLOR switch was included in a previous DEVICE call (to set the other PS stuff)
> Make sure that you do any LOADCT's after the DEVICE call.
Ah. Yes, there were TVLCT calls after the DEVICE call.
> You also should not need to put CMYK values in the color table with
> TVLCT/CMYK_CONVERT. The PS device should do this for you.
>
> For a program like:
>
>
> SET_PLOT, 'ps'
> DEVICE, /CMYK, /COLOR
> LOADCT, 5
> n = 50 ; Size of array for Bessel
> ; Make the Bessel function:
> a = BESELJ(SHIFT(DIST(n), n/2, n/2)/2, 0)
> TVSCL, DIST(n)
> nlev = 8 ; Number of contour levels
> ; Make the Contour at normalized Z=.6:
> CONTOUR, a, /OVERPLOT, ZVALUE=.6, /T3D, $
> LEVELS=FINDGEN(nlev)*1.5/nlev-.5, COLOR=1
> DEVICE, /CLOSE
>
>
>
> you'll see an image in the PS file that uses a COLORTAB and
>
> and is rendered with something like:
>
> {COLORTAB currentfile picstr readhexstring pop 0 get
> 4 mul 4 getinterval } bind false 4 colorimage
>
> Things like contour lines will have postscript color commands like
>
> 1.000 1.000 0.000 0.980 setcmykcolor
>
> Hope this helps,
Excellent! Yep - we now have a cmyk output file! Thanks very much!
(The reason for the multiple !!!'s is that my colleague is leaving for a conference to
China for a couple of weeks and the editor wanted a reply today. So, tell your boss you
deserve a raise! :o)
cheers,
paulv
--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Ph: (301)763-8000 x7748
Fax:(301)763-8545
|
|
|
Re: How to do RGB to CMYK conversion for PS output? [message #49314 is a reply to message #49313] |
Thu, 13 July 2006 12:23   |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
On Thu, 13 Jul 2006 14:31:22 -0400, Paul Van Delst wrote:
> Hello there,
>
> A colleague produced a colour X-Y plot for a paper and saved it to a regular old PS file.
> The editor mailed back stating that the file contains RGB colours and could we please
> create the file in CMYK colours.
>
> How does one do this? Using
> DEVICE,/CMYK
> produced exactly the same PS file.
>
> Doing,
> TVLCT,r,g,b,/GET
> CMYK_CONVERT,c,m,y,k,r,g,b,/TO_CMYK
> produced the appropriate c, m, y, and k arrays, but how does one "load" the CMYK arrays to
> be used? Doing
> TVLCT,c,m,y
> produced exactly what I thought would happen - no black.
>
> Any ideas?
Yes.
Try:
DEVICE, /CMYK, /COLOR
You need to put the device into color mode when you select CMYK :-).
Make sure that you do any LOADCT's after the DEVICE call.
You also should not need to put CMYK values in the color table with
TVLCT/CMYK_CONVERT. The PS device should do this for you.
For a program like:
SET_PLOT, 'ps'
DEVICE, /CMYK, /COLOR
LOADCT, 5
n = 50 ; Size of array for Bessel
; Make the Bessel function:
a = BESELJ(SHIFT(DIST(n), n/2, n/2)/2, 0)
TVSCL, DIST(n)
nlev = 8 ; Number of contour levels
; Make the Contour at normalized Z=.6:
CONTOUR, a, /OVERPLOT, ZVALUE=.6, /T3D, $
LEVELS=FINDGEN(nlev)*1.5/nlev-.5, COLOR=1
DEVICE, /CLOSE
you'll see an image in the PS file that uses a COLORTAB and
and is rendered with something like:
{COLORTAB currentfile picstr readhexstring pop 0 get
4 mul 4 getinterval } bind false 4 colorimage
Things like contour lines will have postscript color commands like
1.000 1.000 0.000 0.980 setcmykcolor
Hope this helps,
Karl
|
|
|
Re: How to do RGB to CMYK conversion for PS output? [message #49317 is a reply to message #49314] |
Thu, 13 July 2006 11:46   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul Van Delst writes:
> A colleague produced a colour X-Y plot for a paper and saved it to a regular old PS file.
> The editor mailed back stating that the file contains RGB colours and could we please
> create the file in CMYK colours.
>
> How does one do this? Using
> DEVICE,/CMYK
> produced exactly the same PS file.
>
> Doing,
> TVLCT,r,g,b,/GET
> CMYK_CONVERT,c,m,y,k,r,g,b,/TO_CMYK
> produced the appropriate c, m, y, and k arrays, but how does one "load" the CMYK arrays to
> be used? Doing
> TVLCT,c,m,y
> produced exactly what I thought would happen - no black.
>
> Any ideas?
Photoshop?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: How to do RGB to CMYK conversion for PS output? [message #49386 is a reply to message #49317] |
Sat, 15 July 2006 12:31  |
George N. White III
Messages: 56 Registered: September 2000
|
Member |
|
|
On Thu, 13 Jul 2006, David Fanning wrote:
> Paul Van Delst writes:
>
>> A colleague produced a colour X-Y plot for a paper and saved it to a
>> regular old PS file. The editor mailed back stating that the file
>> contains RGB colours and could we please create the file in CMYK
>> colours.
>> [...]
>> Any ideas?
>
> Photoshop?
Yes. There is generally a significant difference between the CMYK you get
using Photoshop and from IDL. I think IDL uses the simple formula:
C=255-R ...
K=min([C,M,Y])
C=C-K ...
This seems reasonable in theory, but in practice CMYK devices have a
restricted gamut compared to typical (CRT and LCD) displays. Different
printers handle out-of-gamut values differently, but most will give muddy
looking colors with CMYK images created by IDL using a color palette that
looks good on a display. Photoshop generally does a much better job (and
will show you which colors are outside the CMYK gamut). For best results
you need color profiles for both the display and for the output device.
--
George N. White III <aa056@chebucto.ns.ca>
|
|
|