comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Why does color change to b/w when using PNG?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Why does color change to b/w when using PNG? [message #38540] Tue, 16 March 2004 14:59 Go to previous message
bleau is currently offline  bleau
Messages: 24
Registered: November 1993
Junior Member
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
[Message index]
 
Read Message
Read Message
Previous Topic: Color table editor
Next Topic: Re: Color table editor

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 00:15:49 PDT 2025

Total time taken to generate the page: 1.27952 seconds