Re: write graphics to file? [message #4725 is a reply to message #4719] |
Tue, 18 July 1995 00:00   |
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
|
|
|