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

Home » Public Forums » archive » Re: Support for image formats
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: Support for image formats [message #12782 is a reply to message #12779] Thu, 10 September 1998 00:00 Go to previous messageGo to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
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.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Thanks for replies
Next Topic: Re: [Q] extracting value from a structure ...

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

Current Time: Sat Oct 11 06:56:32 PDT 2025

Total time taken to generate the page: 0.31693 seconds