Getting 256 Colors in PostScript Output
QUESTION: My images look like they only have about a dozen colors. I thought I had a 256 color (or grayscale) PostScript printer. What's going on?
![]()
ANSWER: By default, the IDL PostScript driver is set up to deliver only 16 colors or shades of gray for image output. If you don't know this, your PostScript images will look "washed out" or "blocky".
The default setting for the PostScript driver is to save 4 bits of information for each image pixel. This is enough for only 16 colors or shades of gray. If you want 256 colors, you must set the BITS_PER_PIXEL keyword to 8, in addition to setting the COLOR keyword, like this:
SET_PLOT, 'PS' DEVICE, BITS_PER_PIXEL=8, COLOR=1
Note that a tool like PSConfig, which I always use to configure the PostScript device, assumes 8 bits per pixel and color or grayscale output by default.
keywords = PSConfig(Cancel=cancelled)
IF ~cancelled THEN BEGIN
thisDevice = !D.Name
Set_Plot, 'PS'
Device, _EXTRA=keywords
Plot, findgen(11) ; Or whatever your graphics needs are.
Device, /Close_File
Set_Plot, thisDevice
ENDIF
![]() |
| PSConfig is an easy way to allow the user to completely configure the PostScript device. It sets BITS_PER_PIXEL=8 and COLOR=1 by default. |
![]()
Copyright © 1996-2001 David W. Fanning
Last Updated 16 October 2001
