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

Home » Public Forums » archive » Re: write graphics to file?
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: write graphics to file? [message #4725 is a reply to message #4719] Tue, 18 July 1995 00:00 Go to previous messageGo to previous message
Kenneth S. Kump is currently offline  Kenneth S. Kump
Messages: 5
Registered: June 1995
Junior Member
Here is a quick little bit of code which "captures" any idl window (not just
plot window) into an image. I often use it like this:

write_gif,'out.gif',plot2image()


_________________________________________________

function plot2image,windown
;+
; NAME: PLOT2IMAGE
;
; Purpose: Reads the plot from the currently active window and converts it
; to an image which can be printed, converted to a slide or file
;
; USAGE: RESULT=plot2image([window_number])
;
; If window_number is not given, the current window is used.
; Will prompt you to invert image or not.
;
;
; Ken Kump 12/94
;-

if n_elements(windown) gt 0 then wset,windown
info=!d
x=info.x_vsize
y=info.y_vsize ; gets the visible size from the display
image=tvrd(0,0,x,y)
print,"do you wish to invert the image? (y/n) "
; since it will contain black pixels if plotting background is black.
ans=get_kbrd(2)
if(ans eq 'y') then image= not image
return,image
end

hartman@fys.ruu.nl (Jan Willem Hartman) wrote:

> I would like to have a file dump of my IDL window, in any graphics
> format. Something like 'set_plot,'gif' will do very well.., I know
> there are lots of routines that let you write a gif/tiff/whatever file
> from an image, but what if you just have an x-y plot, and want to save
> that plot to a gif-file, without loosing a lot of information? It
> shoud also work on MS-windows version of IDL, so a 'spawn,"xwd .."'
> will not do.
> If anybody knows, thanks in advance.
>
> JanWillem
>
>
>

--

Ken Kump

Biomedical Image Processing Laboratory
Department of Biomedical Engineering
Case Western Reserve University
Cleveland, Ohio 44106, USA

E-mail: kump@morph.ebme.cwru.edu
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Contour problems...
Next Topic: Re: Errors in continental outlines

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

Current Time: Sat Oct 11 14:20:45 PDT 2025

Total time taken to generate the page: 0.48447 seconds