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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: write graphics to file? [message #4719] Wed, 19 July 1995 00:00
bleau is currently offline  bleau
Messages: 24
Registered: November 1993
Junior Member
In article <DBuB0r.AD0@midway.uchicago.edu>, rivers@cars3.uchicago.edu (Mark Rivers) writes:
>> I would like to have a file dump of my IDL window, in any graphics
>> format.
[snip]
>
> This question has been answered a number of times recently, it probably belongs
> in the FAQ.
>
> IDL> plot, x, y, title = 'This is my plot'
> IDL> image = tvrd()
> IDL> write_gif, file, image ....
>
> I believe this sequence works if you are on any windowing display (X, Windows,
> Mac). For better speed and more flexibility, first issue the command
> SET_PLOT, 'Z', /NOZ
> to write to the Z-buffer pseudo-device. You can set its resolution, and its
> write and readback performance is very fast.
>
Maybe if should (be in the FAQ, that is); I'm the previous person to ask about
it, I believe. I decided to but in on this thread, though, to ask a related
question: How does one create a color GIF file? write_gif loads&compiles some
other procedures, one of which is a black&white color table. The messages it
(write_gif) gives are:

% Compiled module: WRITE_GIF.
% Compiled module: LOADCT.
% Compiled module: FILEPATH.
% LOADCT: Loading table B-W LINEAR

Has anyone used this before to store a color image? I can rtfm on setting up
color tables and plotting them to the Z device and all, but since write_gif
isn't documented that well I haven't the faintest idea what I need to do
make it write out a color gif file. Ideas?

Larry Bleau
University of Maryland
bleau@umdsp.umd.edu
301-405-6223
Re: write graphics to file? [message #4725 is a reply to message #4719] Tue, 18 July 1995 00:00 Go 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
Re: write graphics to file? [message #4729 is a reply to message #4725] Mon, 17 July 1995 00:00 Go to previous message
hartman is currently offline  hartman
Messages: 9
Registered: August 1994
Junior Member
In <DBuB0r.AD0@midway.uchicago.edu> rivers@cars3.uchicago.edu (Mark Rivers) writes:


> This question has been answered a number of times recently, it probably belongs
> in the FAQ.

> IDL> plot, x, y, title = 'This is my plot'
> IDL> image = tvrd()
> IDL> write_gif, file, image ....

Thanks - I love you all... :-)


> I believe this sequence works if you are on any windowing display (X, Windows,
> Mac). For better speed and more flexibility, first issue the command
> SET_PLOT, 'Z', /NOZ

IDL says:
Keyword NOZ not allowed in call to: SET_PLOT

But using 'tvrd' works great for me.

JanWillem
Re: write graphics to file? [message #4730 is a reply to message #4729] Mon, 17 July 1995 00:00 Go to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <hartman.805901825@ruund9.fys.ruu.nl>, hartman@fys.ruu.nl (Jan Willem Hartman) writes:
> Hello all,
>
> Yet another question...
> 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.

This question has been answered a number of times recently, it probably belongs
in the FAQ.

IDL> plot, x, y, title = 'This is my plot'
IDL> image = tvrd()
IDL> write_gif, file, image ....

I believe this sequence works if you are on any windowing display (X, Windows,
Mac). For better speed and more flexibility, first issue the command
SET_PLOT, 'Z', /NOZ
to write to the Z-buffer pseudo-device. You can set its resolution, and its
write and readback performance is very fast.

____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Contour problems...
Next Topic: Re: Errors in continental outlines

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

Current Time: Wed Oct 08 15:06:10 PDT 2025

Total time taken to generate the page: 0.00690 seconds