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

Home » Public Forums » archive » Re: How to directly write figure to png without open x-window in IDL5.4?
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: How to directly write figure to png without open x-window in IDL5.4? [message #32834] Thu, 14 November 2002 06:47
ninghai is currently offline  ninghai
Messages: 3
Registered: October 2002
Junior Member
Craig Markwardt <craigmnet@cow.physics.wisc.edu> wrote in message news:<on7kfglqx2.fsf@cow.physics.wisc.edu>...
> David Fanning <david@dfanning.com> writes:
>
>> Ninghai Sun (ninghai@whidc.com) writes:
>>
>>> Now, I first write to PS and then convert to png in cronjob. No
>>> problem in linux. But if logout of Linux when the idl code is running,
>>> always get error that no x-window is opened. Any idea how to figure it
>>> out?
>>
>> Use the Z-buffer for a window.
>>
>> thisDevice = !D.Name
>> Set_Plot, 'Z'
>> LOADCT, 5 ; of whatever you do to load colors
>> TVLCT, r, g, b, /GET
>> Device, Z_Buffer=0, Set_Resolution=[400, 300] ; or whatever
>> TV, image ; Or, whatever graphics you display
>> snapshot = TVRD()
>> Set_Plot, thisDevice
>> Write_PNG, 'myfile.png, snapshot, r, g, b

Seems this way still doesn't work in my Linux machine. When the
cronjob was running after I log out of Linux, only error msg is
returned, which is "Xlib: connection to "0:0" refused by server.
Xlib:Client is not authorized to connect to server." Is this because
IDL problem or my Linux X-win proble? I am confused.

> Speaking of being stuck in IDL 5.4, I have found that TVRD() and
> WRITE_PNG have two slightly different behaviors, depending on whether
> IDL 5.4 (or earlier), or 5.5 are used. In the earlier versions, the
> graphic is vertically flipped. In my little Z buffer PNG screen
> capture code, I have something like this to test for IDL version:
>
>
> img = tvrd()
> if float(!version.release) LT 5.5 then $
> img = reverse(img, 2)
>
> write_png, filename, img, ctab, ctab, ctab
>
> Craig

Seems it's not necessary to do so on my IDL 5.4 in linux.
Re: How to directly write figure to png without open x-window in IDL5.4? [message #32837 is a reply to message #32834] Wed, 13 November 2002 20:24 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
David Fanning <david@dfanning.com> writes:

> Ninghai Sun (ninghai@whidc.com) writes:
>
>> Now, I first write to PS and then convert to png in cronjob. No
>> problem in linux. But if logout of Linux when the idl code is running,
>> always get error that no x-window is opened. Any idea how to figure it
>> out?
>
> Use the Z-buffer for a window.
>
> thisDevice = !D.Name
> Set_Plot, 'Z'
> LOADCT, 5 ; of whatever you do to load colors
> TVLCT, r, g, b, /GET
> Device, Z_Buffer=0, Set_Resolution=[400, 300] ; or whatever
> TV, image ; Or, whatever graphics you display
> snapshot = TVRD()
> Set_Plot, thisDevice
> Write_PNG, 'myfile.png, snapshot, r, g, b

Speaking of being stuck in IDL 5.4, I have found that TVRD() and
WRITE_PNG have two slightly different behaviors, depending on whether
IDL 5.4 (or earlier), or 5.5 are used. In the earlier versions, the
graphic is vertically flipped. In my little Z buffer PNG screen
capture code, I have something like this to test for IDL version:


img = tvrd()
if float(!version.release) LT 5.5 then $
img = reverse(img, 2)

write_png, filename, img, ctab, ctab, ctab

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: How to directly write figure to png without open x-window in IDL5.4? [message #32839 is a reply to message #32837] Wed, 13 November 2002 13:38 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ninghai Sun (ninghai@whidc.com) writes:

> Now, I first write to PS and then convert to png in cronjob. No
> problem in linux. But if logout of Linux when the idl code is running,
> always get error that no x-window is opened. Any idea how to figure it
> out?

Use the Z-buffer for a window.

thisDevice = !D.Name
Set_Plot, 'Z'
LOADCT, 5 ; of whatever you do to load colors
TVLCT, r, g, b, /GET
Device, Z_Buffer=0, Set_Resolution=[400, 300] ; or whatever
TV, image ; Or, whatever graphics you display
snapshot = TVRD()
Set_Plot, thisDevice
Write_PNG, 'myfile.png, snapshot, r, g, b

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to directly write figure to png without open x-window in IDL5.4?
Next Topic: Martin's Library is Back!

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

Current Time: Wed Oct 08 19:47:58 PDT 2025

Total time taken to generate the page: 0.00852 seconds