Gary Beard wrote:
> Are there any routines for outputing plots in standard image formats
> such as .gif or .jpg etc. The .cgm implementation doesn't seem to work
> properly on our system, leaving me with only the PostScript option. This is
> fine, but although encapsulated PS can be included in MS Word, it cannot
> be viewed. Yes, I could use third party format conversion packages, but
> these invariably yield poor results.
Gary,
There are basically two ways to capture IDL graphics output to a file.
High quality raster/vector graphics
-----------------------------------
You can use one of the standard IDL graphics devices to capture the
graphics as they are created, e.g. Postscript, HPGL, CGM, PCL. Of these
formats, Postscript is the one I use most often to capture high-quality
graphics from IDL. See the on-line help for 'Graphics Devices'.
Postscript output from IDL can be imported into Microsoft Word on the PC
(however you won't see a preview image). If you want to create a preview
image that Word will understand, I recommend the GSView package
(http://www.cs.wisc.edu/~ghost). Here's what I do:
(1) Create the graphic in IDL:
(this example requires http://www.dfanning.com/programs/tvimage.pro and
http://www.dfanning.com/programs/aspect.pro)
;- Create a color image in Postscript
set_plot,'PS'
device,/helv,/color,bits=8,file='image.ps'
loadct,39
!p.font=0
pos=aspect()
tvimage,bytscl(dist(256),top=!d.table_size-1),pos=pos
plot,[0],/nodata,title='My Image in IDL',pos=pos,/noerase
device,/close
exit
(2) Start GSView and do the following:
File, Open, (select 'image.ps')
File, PS to EPS, Yes (Check 'Automatically calculate Bounding Box')
Save the file as 'image.eps'
File, Close
File, Open, (select 'image.eps')
Options, (select 'EPS Clip')
Edit, Add EPS Preview, Windows Metafile
Save the file as 'image.eps'
(3) Start MSWord (I use Word97)
Insert, Picture, From File (select 'image.eps')
You should see a color preview of the image on-screen. If you print to a
Postscript printer, you will get the Postcript version of the graphic.
If you print to a non-Postscript printer, you will get the preview
version of the graphic.
Bitmap images
-------------
You can use an IDL routine to save a graphic from a current window to an
image (bitmap) file. The relevant routines (in IDL 5.1) are WRITE_BMP,
WRITE_GIF, WRITE_JPEG, WRITE_NRIF, WRITE_PICT, WRITE_PPM, WRITE_SRF,
WRITE_TIFF, WRITE_WAVE. See the on-line help for 'Alphbetical List of
Routines'. Note that this method saves bitmap images only. To improve
image quality when importing into MSWord, a common tactic is to display
the graphic in a huge window (say 1024x1024 pixels) with large
characters, and save that to a GIF/JPEG/etc. Then the image will retain
decent resolution when imported into MSWord.
Cheers,
Liam.
|