Image Colors Different in PostScript Than On the Display
QUESTION: I'm trying to display my 24-bit image in a PostScript file. I have IDL 7.1 (which supports 24-bit color) and I have set my PostScript device up to use 24-bit color with the DECOMPOSED=1 keyword. But the image in my PostScript file is displayed in completely different colors than when I display the image in a graphics window on my display. Am I doing something wrong?
ANSWER: I would argue not, but that wouldn't change the result for you. What you are missing is a complete understanding of how 24-bit colors work in PostScript with respect to 24-bit images. It would seem logical that a 24-bit image should not have anything whatsoever to do with color tables, since all the colors in the world (well, 16.7 million of them anyway) can potentially be present in the image directly. That, in fact, is the definition of a true-color image.
But for God only knows what reason, ITTVIS has decided that 24-bit images will be routed through the current color table in PostScript devices, thereby mixing up their colors to such an extent that they are completely unrecognizable on the other side. Think of it as a morphing mirror for producing jokes on your colleagues. You see an example of such an image in the figure on the right below.
(Note that this is similar to the way 24-bit images were displayed on Windows machines prior to IDL 6.4, although someone finally came to their senses and changed this behavior so we no longer have to worry about it when we display 24-bit images in a graphics window.)
|24-bit images are inexplicably routed through the color table in 24-bit color
Image with color table 0 loaded on the left, and with color table 5 loaded on the right.
In any case, if you plan to display 24-bit images in a PostScript device with color decomposition or true-color output turned on, you need to make absolutely sure that you load a gray-scale color table before you display the image.
thisDevice = !D.Name rose = LoadData(16) LoadCT, 0, /Silent Set_Plot, 'PS' Device, DECOMPOSED=1, COLOR=1, BITS_PER_PIXEL=8 TV, rose, TRUE=1 Device, /CLOSE_FILE Set_Plot, thisDevice
thisDevice = !D.Name rose = LoadData(16) Set_Plot, 'PS' Device, DECOMPOSED=1, COLOR=1, BITS_PER_PIXEL=8 TVImage, rose Device, /CLOSE_FILE Set_Plot, thisDevice
Version of IDL used to prepare this article: IDL 7.1.
Copyright © 2009 David W. Fanning
Last Updated 25 May 2009