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

Home » Public Forums » archive » Re: converting window into a image
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
Re: converting window into a image [message #47008] Wed, 18 January 2006 14:51 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Ah, there you go. I think that is the problem. When
> reading back colors off the display, I can't get
> a full 8 bits in each channel. Thus, a full white [255,255,255]
> is probably impossible.

And I can imagine, Matt, that this is a bit of a hardship
when working with snow and ice data. Your sys admin people
will surely be sympathetic. If not, let us know, and we will
get a petition together on your behalf. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: converting window into a image [message #47009 is a reply to message #47008] Wed, 18 January 2006 14:47 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matt writes:

> This might be the trick. It looks like I'm running a 16 bit color? Maybe
> I'll get my admin to change it to 24bit color and I'll see how that works.
>
>
>
>
> IDL> help, /device
> Available Graphics Devices: CGM HP LJ NULL PCL PRINTER PS REGIS TEK X Z
> Current graphics device: X
> Server: X11.0, The XFree86 Project, Inc, Release 40300001
> Display Depth, Size: 16 bits, (1600,1200)
> Visual Class: TrueColor (4)
> Bits Per RGB: 6 (5/6/5)
> Physical Color Map Entries (Emulated / Actual): 256 / 64
> Colormap: Shared, 65536 colors. Translation table: Bypassed
> Graphics pixels: Combined, Dither Method: Ordered
> Write Mask: 65535 (decimal) ffff (hex)
> Graphics Function: 3 (copy)
> Current Font: -*-*-bold-r-*-*-15-*-*-*-*-*-*-*, Current TrueType Font: <default>
> Default Backing Store: Pixmap.

Ah, there you go. I think that is the problem. When
reading back colors off the display, I can't get
a full 8 bits in each channel. Thus, a full white [255,255,255]
is probably impossible.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: converting window into a image [message #47010 is a reply to message #47009] Wed, 18 January 2006 14:30 Go to previous messageGo to next message
savoie is currently offline  savoie
Messages: 68
Registered: September 1996
Member
David Fanning <davidf@dfanning.com> writes:

> savoie@nsidc.org writes:
>
>> I removed all of my start up commands. So it's not running any IDL startup
>> script, (verified this because it couldn't find fsc_color()) when I tried to
>> run it first.
>>
>> I open up the gimp and I get the same problem, mostly R:248 G:252 B:248.
>>
> Humm. I assume you are using the latest version of TVREAD, etc.

Yup, just grabbed it from your site.

> Could it be GIMP? Have you tried in another piece of software?
Nope, I tried it in firefox, and gimp, and I've seen it mostly when I print
something out on a color printer.


> Do you have a 16-bit display or 24-bit?

This might be the trick. It looks like I'm running a 16 bit color? Maybe
I'll get my admin to change it to 24bit color and I'll see how that works.




IDL> help, /device
Available Graphics Devices: CGM HP LJ NULL PCL PRINTER PS REGIS TEK X Z
Current graphics device: X
Server: X11.0, The XFree86 Project, Inc, Release 40300001
Display Depth, Size: 16 bits, (1600,1200)
Visual Class: TrueColor (4)
Bits Per RGB: 6 (5/6/5)
Physical Color Map Entries (Emulated / Actual): 256 / 64
Colormap: Shared, 65536 colors. Translation table: Bypassed
Graphics pixels: Combined, Dither Method: Ordered
Write Mask: 65535 (decimal) ffff (hex)
Graphics Function: 3 (copy)
Current Font: -*-*-bold-r-*-*-15-*-*-*-*-*-*-*, Current TrueType Font: <default>
Default Backing Store: Pixmap.


Thanks
Matt




--
Matthew Savoie - Scientific Programmer
National Snow and Ice Data Center
(303) 735-0785 http://nsidc.org
Re: converting window into a image [message #47011 is a reply to message #47010] Wed, 18 January 2006 14:04 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
savoie@nsidc.org writes:

> I removed all of my start up commands. So it's not running any IDL startup
> script, (verified this because it couldn't find fsc_color()) when I tried to
> run it first.
>
> I open up the gimp and I get the same problem, mostly R:248 G:252 B:248.
>
> So, long story, short, with no startup commands, I get the same issues.
> I've had this on several versions of IDL. I'm currently running 6.2, under
> SuSE Linux 9.x.
>
> I also tried with just these commands in the startup file.
>
> device, true=24
> device, retain=2, decomposed=0,set_character_size=[10,12]
> device, get_visual_depth = depth
>
> I get the same thing.

Humm. I assume you are using the latest version of TVREAD, etc.

Could it be GIMP? Have you tried in another piece of software?

Do you have a 16-bit display or 24-bit?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: converting window into a image [message #47012 is a reply to message #47011] Wed, 18 January 2006 13:37 Go to previous messageGo to next message
savoie is currently offline  savoie
Messages: 68
Registered: September 1996
Member
David Fanning <davidf@dfanning.com> writes:

> Matt writes:
>> Can anyone help? Did I miss that tutorial?
>
> I suspect the problem is here:
>
>> device, true=24
>> window, /free, /pixmap, colors=-10
>
> What in God's name is that Window command doing there!?
> (I know why it *used* to be there, but it is no longer
> needed on 24-bit displays.)

I'm sure they're in there because I've been using IDL for a long time?


> What happens if you remove it?


I removed all of my start up commands. So it's not running any IDL startup
script, (verified this because it couldn't find fsc_color()) when I tried to
run it first.

I open up the gimp and I get the same problem, mostly R:248 G:252 B:248.

So, long story, short, with no startup commands, I get the same issues.
I've had this on several versions of IDL. I'm currently running 6.2, under
SuSE Linux 9.x.

I also tried with just these commands in the startup file.

device, true=24
device, retain=2, decomposed=0,set_character_size=[10,12]
device, get_visual_depth = depth

I get the same thing.

Anyone with suggestions?

Thanks
Matt






WOW. Here's a suprising aside! With no startup file, if my IDL window is
open in the background, in my generated png, I get what is in my foreground?
See it here: http://cires.colorado.edu/~savoie/test.png

Hmm. I wonder if I had a backing store setup in my idl_setup.pro. Sorry,
Looks like a false alarm, but I'll leave it in here in case someone else has
this problem and finds this on google. This is apparently the fixer.

I also have in my idl_startup.pro:
device, retain=2, decomposed=0, set_character_size[10,12]











--
Matthew Savoie - Scientific Programmer
National Snow and Ice Data Center
(303) 735-0785 http://nsidc.org
Re: converting window into a image [message #47014 is a reply to message #47012] Wed, 18 January 2006 10:47 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matt writes:

> When I examine the output png, the background is not white, but
> some combination of R:255, G: 251, B:255., and R:247, G:256, B:247, etc...

Oh, here is *another* possibility! (I should just take five
minutes and think about this, I guess, but that wouldn't
have as much suspense.) If you are displaying the PNG
file in the *&%$# Internet Explorer, the whites could
probably be any damn color! Until Microsoft gets it
together you better look at PNG files in something else.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: converting window into a image [message #47015 is a reply to message #47014] Wed, 18 January 2006 10:44 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matt writes:

> When I examine the output png, the background is not white, but
> some combination of R:255, G: 251, B:255., and R:247, G:256, B:247, etc...

I suppose another possibility is an old version of TVRead.
I used to COLOR_QUAN PGN files, but I changed that in May of 2002.
Here is the latest:

http://www.dfanning.com/programs/tvread.pro

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: converting window into a image [message #47016 is a reply to message #47015] Wed, 18 January 2006 10:39 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matt writes:

> O.k. everyone, I'm a huge fan of the tvread(). But I want to know is, is
> there a way to force white to actually be white when writing a png?
>
> When I start my idl session, I use Liam's excellent startup ideas for setting
> windowing and color.
>
> device, true=24
> window, /free, /pixmap, colors=-10
> wdelete, !d.window
> device, retain=2, decomposed=0,set_character_size=[10,12]
> device, get_visual_depth = depth
>
>
> So then say for example, I'm running these commands.
>
> x = indgen( 50 )
> y = sin( x )
> plot, x, y, BACKGROUND= fsc_color( 'white', 250 ), color= fsc_color( 'black', 251 )
> x = tvread(/png, FILENAME= "test", /NODIALOG,quality=100)
>
> When I examine the output png, the background is not white, but
> some combination of R:255, G: 251, B:255., and R:247, G:256, B:247, etc...
>
> It doesn't matter on the screen, but when I print out my plots, they come out
> with a green or yellow tint and against the white margins, they just look
> kinda yucky.
>
> Can anyone help? Did I miss that tutorial?

Humm. Weird.

I just typed those commands, opened the PNG file up in Photoshop
and the whites are as white as can be. The Info palette confirms
values of [255,255,255] as I run the cursor over the image.

I suspect the problem is here:

> device, true=24
> window, /free, /pixmap, colors=-10

What in God's name is that Window command doing there!?
(I know why it *used* to be there, but it is no longer
needed on 24-bit displays.)

What happens if you remove it?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: converting window into a image [message #47017 is a reply to message #47016] Wed, 18 January 2006 10:13 Go to previous messageGo to next message
savoie is currently offline  savoie
Messages: 68
Registered: September 1996
Member
David Fanning <davidf@dfanning.com> writes:

> You can find TVREAD here:
>
> http://www.dfanning.com/programs/tvread.pro
>
> You can pretty much save the file in any format you like.
> Just set the appropriate keyword.


O.k. everyone, I'm a huge fan of the tvread(). But I want to know is, is
there a way to force white to actually be white when writing a png?

When I start my idl session, I use Liam's excellent startup ideas for setting
windowing and color.

device, true=24
window, /free, /pixmap, colors=-10
wdelete, !d.window
device, retain=2, decomposed=0,set_character_size=[10,12]
device, get_visual_depth = depth


So then say for example, I'm running these commands.

x = indgen( 50 )
y = sin( x )
plot, x, y, BACKGROUND= fsc_color( 'white', 250 ), color= fsc_color( 'black', 251 )
x = tvread(/png, FILENAME= "test", /NODIALOG,quality=100)

When I examine the output png, the background is not white, but
some combination of R:255, G: 251, B:255., and R:247, G:256, B:247, etc...

It doesn't matter on the screen, but when I print out my plots, they come out
with a green or yellow tint and against the white margins, they just look
kinda yucky.

Can anyone help? Did I miss that tutorial?

Thanks
Matt


--
Matthew Savoie - Scientific Programmer
National Snow and Ice Data Center
(303) 735-0785 http://nsidc.org
Re: converting window into a image [message #47026 is a reply to message #47017] Tue, 17 January 2006 13:32 Go to previous messageGo to next message
CD is currently offline  CD
Messages: 5
Registered: January 2006
Junior Member
thanks a lot..this was exactly what i needed!!

cheers,
-cd
Re: converting window into a image [message #47027 is a reply to message #47026] Tue, 17 January 2006 12:55 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
CD writes:

> i am a novice with IDL, so wanted some help.
>
> I used the window and tvscl to display a couple of pictures in the same
> window in a particular order. Now the way these images are displayed in
> the window, i want to copy the entire thing into one image. so that
> that image when opened using a image viewer will show those pics the
> same way as in the window of IDL.

Suppose you want to make a JPEG file. First display
your images in the window. Then type this:

void = TVRead(/JPEG, Filename='test')

That's it. Don't put a file extension on the file
name. It will be added automatically. :-)

You can find TVREAD here:

http://www.dfanning.com/programs/tvread.pro

You can pretty much save the file in any format you like.
Just set the appropriate keyword.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: converting window into a image [message #47126 is a reply to message #47009] Tue, 24 January 2006 07:35 Go to previous message
mattie is currently offline  mattie
Messages: 4
Registered: January 2006
Junior Member
David Fanning wrote:

> Ah, there you go. I think that is the problem. When
> reading back colors off the display, I can't get
> a full 8 bits in each channel. Thus, a full white [255,255,255]
> is probably impossible.
>
> Cheers,
>
> David
> --

Well, I'm sure you've all been waiting on the edge of your seat to find
out. Drum roll please. Yep. That was the problem. 16 bit color
didn't do the trick. 24 bit color did.

Thanks for the help.

Matt (via personal account)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: iTools Data Manager
Next Topic: Re: Linux Help Needed

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

Current Time: Fri Oct 10 15:59:31 PDT 2025

Total time taken to generate the page: 0.95877 seconds