Re: How to make GIF file? [message #4543] |
Sat, 10 June 1995 00:00 |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <3ra31t$j08@hecate.umd.edu>, bleau@UMDSP.UMD.EDU (Lawrence Bleau) writes:
> Hi. I running IDL V3.6.1 and have a question about plotting. First, let me
> describe what I'm trying to do overall, in case anyone has a better suggestion
> on how to do it.
>
> I want to create a GIF file to put on my system and have it served over the WWW
> to other sites. This GIF file is a fairly simple plot, with X- and Y-axis, a
> bunch of points, and lines connecting them. The raw data for this is an Ascii
> file with columns of floating point numbers.
>
> I figure we'll have to write a procedure to read in the values, do some
> decision making, and plot them. I know about the PLOT command in IDL, and
> there's enough information I can slug through it and tailor my plots properly;
> if not I'll just come back here for more info.
>
> The puzzling part is how to have PLOT generate a GIF image file. I looked at
> SET_PLOT, which has a slew of options on output devices (PostScript, HP PCL,
> CGM, etc.). GIF, however, is *not* one of those options. I noticed there is a
> WRITE_GIF command, but the manual (unless I've looked in the wrong place)
> doesn't say how to call it and what it's arguments are. Okay, so one of the
> arguments is an array in GIF format. That begs the question, however: How does
> one create the GIF image in the first place? If it isn't done with PLOT, then
> how? If it is, what's the magic keyword?
>
Try the following:
IDL> set_plot, 'z' ; Select the Z pseudo device
; Set the resolution, turn off Z buffering for increased speed
IDL> device, set_resolution=[800, 500], z=0
IDL> plot, findgen(100) ; Draw the plot
IDL> buff = tvrd() ; Read the bitmap back into an IDL variable
IDL> write_gif, 'filename', buff, ...
____________________________________________________________
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)
|
|
|
Re: How to make GIF file? [message #4545 is a reply to message #4543] |
Sat, 10 June 1995 00:00  |
mathews
Messages: 6 Registered: January 1995
|
Junior Member |
|
|
In article <D9xsFM.7D9@midway.uchicago.edu>,
Mark Rivers <rivers@cars3.uchicago.edu> wrote:
> In article <3ra31t$j08@hecate.umd.edu>, bleau@UMDSP.UMD.EDU (Lawrence Bleau) writes:
>> Hi. I running IDL V3.6.1 and have a question about plotting. First, let me
>> describe what I'm trying to do overall, in case anyone has a better suggestion
>> on how to do it.
>>
>> I want to create a GIF file to put on my system and have it served over the WWW
>> to other sites. This GIF file is a fairly simple plot, with X- and Y-axis, a
>> bunch of points, and lines connecting them. The raw data for this is an Ascii
>> file with columns of floating point numbers.
>>
>> I figure we'll have to write a procedure to read in the values, do some
>> decision making, and plot them. I know about the PLOT command in IDL, and
>> there's enough information I can slug through it and tailor my plots properly;
>> if not I'll just come back here for more info.
>>
>> The puzzling part is how to have PLOT generate a GIF image file. I looked at
>> SET_PLOT, which has a slew of options on output devices (PostScript, HP PCL,
>> CGM, etc.). GIF, however, is *not* one of those options. I noticed there is a
>> WRITE_GIF command, but the manual (unless I've looked in the wrong place)
>> doesn't say how to call it and what it's arguments are. Okay, so one of the
>> arguments is an array in GIF format. That begs the question, however: How does
>> one create the GIF image in the first place? If it isn't done with PLOT, then
>> how? If it is, what's the magic keyword?
>>
>
> Try the following:
>
> IDL> set_plot, 'z' ; Select the Z pseudo device
> ; Set the resolution, turn off Z buffering for increased speed
> IDL> device, set_resolution=[800, 500], z=0
> IDL> plot, findgen(100) ; Draw the plot
> IDL> buff = tvrd() ; Read the bitmap back into an IDL variable
> IDL> write_gif, 'filename', buff, ...
>
> ____________________________________________________________
> 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)
>
I use a similar approach with several WWW-based data systems that
invoke CGI perl scripts via a HTML form. The perl script executes
IDL in batch mode, runs a IDL routine to make a plot of the
selected parameters, and writes the results to a GIF. The perl
program output is displayed on the WWW browser as a HTML document
with an inline GIF image.
An example application is the COHOWeb data system via the URL:
http://nssdc.gsfc.nasa.gov/cohoweb/cw.html
Sample examples of various perl programs that use IDL on the web
and the corresponding HTML forms are available via the following
URL: http://coney.gsfc.nasa.gov/Mathews/misc/idl-www.html
Hope this helps.
Jason Mathews
--
------------------------------------------------------------ ------------------
Jason Mathews, Code 633.2 |National Space Science Data Center
NASA/Goddard Space Flight Center|email: mathews@nssdc.gsfc.nasa.gov
Greenbelt, MD 20771-0001 USA |http://coney.gsfc.nasa.gov/Mathews/jason.html
|
|
|
Re: How to make GIF file? [message #4546 is a reply to message #4543] |
Fri, 09 June 1995 00:00  |
Robert.M.Candey
Messages: 23 Registered: June 1995
|
Junior Member |
|
|
In article <3ra31t$j08@hecate.umd.edu>, bleau@UMDSP.UMD.EDU wrote:
> Hi. I running IDL V3.6.1 and have a question about plotting. First, let me
> describe what I'm trying to do overall, in case anyone has a better suggestion
> on how to do it.
>
> I want to create a GIF file to put on my system and have it served over
the WWW
> to other sites. This GIF file is a fairly simple plot, with X- and Y-axis, a
> bunch of points, and lines connecting them. The raw data for this is an Ascii
> file with columns of floating point numbers.
> . . .
>
> Larry Bleau
> University of Maryland
> bleau@umdsp.umd.edu
> 301-405-6223
This is off the top of my head but should be close. I guess we need to add this to the IDL FAQ.
set_plot,'Z' ; plot to Z so IDL can be used in batch mode
device,z_buffer=0,set_resolution=[400,300] ; size of GIF image
loadct,13 ; or whatever color palette, Z device defaults to 256 colors
plot, . . . ; whatever plot and xyout commands
tvlct, r,g,b, /get ; get colortable actually used
image = tvrd() ; get bitmap from Z device
write_gif, 'file.gif', image, r,g,b
If you transfer the GIF image to a Macintosh, use Fetch and set its Suffix Mapping Custom option to assign the filetype 'GIFf' and use binary transfer.
--
Robert.M.Candey@gsfc.nasa.gov
NASA Goddard Space Flight Center, Code 632
Greenbelt, MD 20771 USA 1-301-286-6707
|
|
|