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

Home » Public Forums » archive » More Questions on 24 bit color
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
More Questions on 24 bit color [message #13336] Tue, 10 November 1998 00:00 Go to next message
David B. Wolff is currently offline  David B. Wolff
Messages: 2
Registered: November 1998
Junior Member
I am having similar problems using 24-bit color on a Linux system. I was
able to get IDL
to properly display my colors using "Device,decomposed=0" as the first call
in my
program; however, if I then try to do a tvrd() to write a gif or other
8-bit image format,
the color palette is not preserved. Does anyone know how to get tvrd() to
read properly.

If you have some suggestions, please e-mail them to me at:
dwolff@ariel.met.tamu.edu.

Thanks,

Dave
Re: More Questions on 24 bit color [message #13438 is a reply to message #13336] Thu, 12 November 1998 00:00 Go to previous messageGo to next message
Richard Kidd is currently offline  Richard Kidd
Messages: 11
Registered: March 1998
Junior Member
Hi all.,
Very Briefly just to say:
"Thanks, David."
Working with various display types/drivers etc and maintaining or retrieving
the correct colours has been a bit of a "bete noir" for myself for quite a
while, but now, no longer do I have to physically reset displays to 256
colours when working with TVRD...
Thanks for the tips. Or should that be, to be more respectful, "Expert
Advice!"
Rich.

Kevin Ivory wrote:

> David Fanning wrote:
>> Oh, sorry, Kevin. I think I am using the IDL 5.2 Color_Quan,
>> which has been fixed. Earlier versions did not work on
>> 24-bit machines! While you are waiting for the official
>> new version you can make yours work by setting the Colors
>> keyword to 256.
>>
>> image2D = Color_Quan(snapshot, 1, r, g, b, Colors=256)
>
> Thanks, David! This is great. Now I don't have to open a virtual terminal
> with 8 bits/pixel whenever I need a GIF image of my IDL window.
>
> In fact, my next wish is that RSI would finally support 16 bits/pixel
> on Unix. That is my default - I have to open a virtual terminal with
> 24 bits/pixel every time I want use IDL's graphical abilities :-(
>
> Best regards,
> Kevin
> --
> Kevin Ivory Tel: +49 5556 979 434
> Max-Planck-Institut fuer Aeronomie Fax: +49 5556 979 240
> Max-Planck-Str. 2 mailto:Kevin.Ivory@linmpi.mpg.de
> D-37191 Katlenburg-Lindau, GERMANY http://www.gwdg.de/~kivory2/
>
>> Note: A copy of this article was e-mailed to the original poster.
> Same here.



--

.......................................................
Richard A.Kidd

Joint Research Centre of the European Communities
Space Applications Institute,
SAR Applications in Agriculture
MARS,
Agricultural and Regional Information Systems
TP 262
21020 ISPRA (VA), ITALY

Tel.: (+39) 0332-786332 Fax: (+39) 0332-789029
Email: richard.kidd@jrc.it
.......................................................
Re: More Questions on 24 bit color [message #13501 is a reply to message #13336] Sat, 14 November 1998 00:00 Go to previous message
Kevin Ivory is currently offline  Kevin Ivory
Messages: 71
Registered: January 1997
Member
David Fanning wrote:
> The results I get are these:
> Colors = 3 Test: 248 248 248

David got a long reply. Here is a short version: I get three different
results (the first to with my startup file, last without, but I didn't
dig any deeper by changing my startup file):

Colors = 3 Test: 255 255 248
Colors = 3 Test: 248 248 255
Colors = 3 Test: 255 255 255

Kevin
--
Kevin Ivory Tel: +49 5556 979 434
Max-Planck-Institut fuer Aeronomie Fax: +49 5556 979 240
Max-Planck-Str. 2 mailto:Kevin.Ivory@linmpi.mpg.de
D-37191 Katlenburg-Lindau, GERMANY http://www.gwdg.de/~kivory2/
Re: More Questions on 24 bit color [message #13505 is a reply to message #13336] Sat, 14 November 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Kevin Ivory (Kevin.Ivory@linmpi.mpg.de) writes:

> Reinhold Schaaf (schaaf@astro.uni-bonn.de) writes:
>> But, although the plot in the IDL-window is white (I mean: *really*
>> white), the background color in the gif-image is not *really* white,
>> but instead a light grey.
>
> David Fanning wrote:
>> Reinhold, I'm sorry to say that this problem cannot be laid
>> on IDL's doorstep. This is a Windows problem. I just ran
>
> Well, it is not a problem of MS Windows - Linux shows the same effect.
> I think COLOR_QUAN gets something mixed up. Try this:

Well, you may be right, Kevin.

Try this program:

PRO TEST
x = FINDGEN(101)
y = SIN(x/10)

red = [0, 1, 1, 0]
green = [0, 1, 0, 0]
blue = [0, 1, 1, 0]
TVLCT, 255*red, 255*green, 255*blue
TVLCT, r, g, b, /Get
Print, 'Original Color Table Max Values: ', Max(r), Max(g), Max(b)
DEVICE, DECOMPOSED=0

PLOT, x, y, BACKGROUND=1, COLOR=2
snapshot = TVRD(True=1)
image2D = COLOR_QUAN(snapshot, 1, r, g, b, Colors=4)
Print, 'Colors = 3 Test: ', Max(r), Max(g), Max(b)
WRITE_GIF, 'test_one.gif', image2D, r, g, b

image2D = COLOR_QUAN(snapshot, 1, r, g, b, Cube=2)
Print, 'Cube = 2 Test: ', Max(r), Max(g), Max(b)
WRITE_GIF, 'test_two.gif', image2D, r, g, b
END

The results I get are these:

IDL> Test
Original Color Table Max Values: 255 255 255
Colors = 3 Test: 248 248 248
Cube = 2 Test: 255 255 255

Moreover, the test_two.gif file shows up with a VERY
white background in Microsoft Word! :-)

I'll ask RSI and see if we can get some kind of
explanation for this.

Cheers,

David

----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: More Questions on 24 bit color [message #13508 is a reply to message #13336] Sat, 14 November 1998 00:00 Go to previous message
Kevin Ivory is currently offline  Kevin Ivory
Messages: 71
Registered: January 1997
Member
Reinhold Schaaf (schaaf@astro.uni-bonn.de) writes:
> But, although the plot in the IDL-window is white (I mean: *really*
> white), the background color in the gif-image is not *really* white,
> but instead a light grey.

David Fanning wrote:
> Reinhold, I'm sorry to say that this problem cannot be laid
> on IDL's doorstep. This is a Windows problem. I just ran

Well, it is not a problem of MS Windows - Linux shows the same effect.
I think COLOR_QUAN gets something mixed up. Try this:

DEVICE, DECOMPOSED=0
tvlct, [0,255], [0,255], [0,255]
plot,sin(0.1*findgen(101)), color=0, back=1
tvlct, r, g, b, /get
print, r[0:1], g[0:1], b[0:1]
; 0 255
; 0 255
; 0 255
snapshot = TVRD(True=1)
image2D = COLOR_QUAN(snapshot, 1, r, g, b, COLORS=2)
print, r, g, b
; 248 0
; 248 0
; 248 0

I must admit, I didn't take the time to read all of those keywords to
COLOR_QUAN. Perhaps one of them already does the right thing. If not,
I'd say it is a bug in IDL (I use: 5.1.1 linux x86).

Best regards
Kevin
--
Kevin Ivory Tel: +49 5556 979 434
Max-Planck-Institut fuer Aeronomie Fax: +49 5556 979 240
Max-Planck-Str. 2 mailto:Kevin.Ivory@linmpi.mpg.de
D-37191 Katlenburg-Lindau, GERMANY http://www.gwdg.de/~kivory2/
Re: More Questions on 24 bit color [message #13510 is a reply to message #13336] Sat, 14 November 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
David Fanning (davidf@dfanning.com) writes:

> Reinhold, I'm sorry to say that this problem cannot be laid
> on IDL's doorstep. This is a Windows problem. I just ran
> your example program and imported the GIF file into Word and,
> sure enough, the background is gray.

For what it is worth, the plot appears to *print* correctly.
That is, on my non-color printer I don't see any strange
background color when I print the results from Word.
Maybe the white to grey transition is just so you can
find the graphic inside the Word document, in which case
I owe an apology to Mr Gates for suspecting that his
thoughtfulness was a sinister plot. :-)

Cheers,

David

----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: More Questions on 24 bit color [message #13511 is a reply to message #13336] Sat, 14 November 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Reinhold Schaaf (schaaf@astro.uni-bonn.de) writes:

> However, this time some question remained. I have the problem to export
> line plots, which are produced by IDL with direct graphics, in some
> format that allows the plots to be imported into Word documents (I am
> working under NT). Since I cannot assume a postscript printer, exporting
> eps-Files is no option. I tried to copy the graphics into the Windows
> clipboard and to paste them into the Word document, which worked; but
> since I want printer output at a reasonable quality (300 dpi) and since
> the size of the plot on the paper has to be not too small (6 inch x 4
> inch), this procedure is too memory intensive to be useful.
>
> So I ended up exporting the plot as a gif-file, which can be imported to
> Word easily. David's advise in this thread came exactley at the right
> time for me, so everything is fine.
>
> But, although the plot in the IDL-window is white (I mean: *really*
> white), the background color in the gif-image is not *really* white,
> but instead a light grey.
>
> Any suggestions (both to the gif color problem and to the export-import
> scheme)?

Reinhold, I'm sorry to say that this problem cannot be laid
on IDL's doorstep. This is a Windows problem. I just ran
your example program and imported the GIF file into Word and,
sure enough, the background is gray.

So, I tried loading it into into Netscape. Background is
*still* grey. Humm. That's odd. So I poked around in
Netscape's Preferences dialog. Ah, here it is. I had
the "Use Windows Colors" button selected. Click that
off, apply the "real" color scheme, and presto, the
background of the GIF image in Netscape is perfectly
white.

The white to grey transition is apparent in Word no
matter how many colors I restrict the GIF file to:

image2D = COLOR_QUAN(snapshot, 1, r, g, b, COLORS=128)

I don't know what to tell you. I tried various things
(including reversing the colors), but to no avail. When
Bill Gates gets it in his head that white should be
rendered as grey, there is apparently little we can do.
Word does exactly the same thing with BMP files.

So I await, with you, more enlightened suggestions.
Perhaps RSI can whip up a WRITE_SCREWY_FORMAT function
especially for Microsoft.

Cheers,

David

----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: More Questions on 24 bit color [message #13512 is a reply to message #13336] Sat, 14 November 1998 00:00 Go to previous message
Reinhold Schaaf is currently offline  Reinhold Schaaf
Messages: 10
Registered: March 1998
Junior Member
I have to admit: I love this newsgroup! More often than not, when I try
to figure out by myself how this or that might work: Presto, there is a
thread in idl-pvwave, where my current problem is discussed!

However, this time some question remained. I have the problem to export
line plots, which are produced by IDL with direct graphics, in some
format that allows the plots to be imported into Word documents (I am
working under NT). Since I cannot assume a postscript printer, exporting
eps-Files is no option. I tried to copy the graphics into the Windows
clipboard and to paste them into the Word document, which worked; but
since I want printer output at a reasonable quality (300 dpi) and since
the size of the plot on the paper has to be not too small (6 inch x 4
inch), this procedure is too memory intensive to be useful.

So I ended up exporting the plot as a gif-file, which can be imported to
Word easily. David's advise in this thread came exactley at the right
time for me, so everything is fine:

x = FINDGEN(101)
y = SIN(x/10)

red = [0, 1, 1, 0, 0, 1, 1, 0]
green = [0, 1, 0, 1, 0, 1, 0, 1]
blue = [0, 1, 0, 0, 1, 0, 1, 1]
TVLCT, 255*red, 255*green, 255*blue

DEVICE, DECOMPOSED=0

PLOT, x, y, BACKGROUND=1, COLOR=6
snapshot = TVRD(True=1)
image2D = COLOR_QUAN(snapshot, 1, r, g, b, COLORS=256)
WRITE_GIF, 'test.gif', image2D, r, g, b

and everything is fine.

But, although the plot in the IDL-window is white (I mean: *really*
white), the background color in the gif-image is not *really* white,
but instead a light grey.

More precisely:

white has RGB values 248,248,248 (instead of 255,255,255)
magenta has 248,0,248 (instead of 248,0,248)

Any suggestions (both to the gif color problem and to the export-import
scheme)?

Thankx in advance!

Reinhold

--
************************************************************ *
Reinhold Schaaf
Ettighofferstr. 22
53123 Bonn
Germany

Tel.: (49)-228-625713
Email: schaaf@astro.uni-bonn.de
************************************************************ *
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Cylindrical map projection screwed up?
Next Topic: Where should I put a preferences file?

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

Current Time: Wed Oct 08 13:36:56 PDT 2025

Total time taken to generate the page: 0.00691 seconds