Re: How to directly write figure to png without open x-window in IDL5.4? [message #32834] |
Thu, 14 November 2002 06:47 |
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  |
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  |
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
|
|
|