I'm running IDL 5.4 on OpenVMS 7.1-2 and am trying to do some plots.
Previously, we were using the ps device (SET_PLOT,'PS') and generating
PostScript files for each plot. We now want to generate PNG files as well.
I copied all the IDL code that generated the PostScript file, changed
SET_PLOT,'PS' to SET_PLOT,'Z', removed most of the device commands (since
few of them apply to the Z device), and ran the IDL code to test it out.
It ran without errors, which is the good news. The bad news is that the
output PNG file seems to be almost all black, with a few white dots where
the data should be, and absolutely no color; the original had color all
over the place. Sounds like a simple case of the color table being wrong,
I thought.
But wait: the PS device used a color table, too, and I didn't change that
part of the code at all! Here's the code that sets up the color table:
; set up a simple color table
bbc = 255b
bfg = 0b
red = [bbc, bfg, 255b, 0b, 0b, 0b, 255b, 255b, 255b, 127b, 0b, $
0b, 127b, 255b, 85b, 170b]
gre = [bbc, bfg, 0b, 255b, 0b, 255b, 0b, 255b, 127b, 255b, 255b, $
127b, 0b, 0b, 85b, 170b]
blu = [bbc, bfg, 0b, 0b, 255b, 255b, 255b, 0b, 0b, 0b, 127b, $
255b, 255b, 127b, 85b, 170b]
tvlct, red, gre, blu
tvlct, bfg, bfg, bfg, !d.n_colors-1
I checked, and print,!d.n_colors-1 displays 255.
So, what's different between these two plot types (PS vs. PNG) that would
cause the same code to produce different results? TIA.
Lawrence Bleau
University of Maryland
Physics Dept., Space Physics Group
301-405-6223
bleau@umtof.umd.edu
|