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 
Return to the default flat view Create a new topic Submit Reply
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 messageGo 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
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
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: Sat Oct 11 05:37:40 PDT 2025

Total time taken to generate the page: 1.04297 seconds