Re: Support for image formats [message #12779] |
Thu, 10 September 1998 00:00 |
mgs
Messages: 144 Registered: March 1995
|
Senior Member |
|
|
In article <35F794DA.2F92CC81@aber.ac.uk>, Gary Beard <agb@aber.ac.uk> 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. Yes, I could use another WP (please no
> Bill
> Gates rants), but Word is standard in our department.
> The lack of IDL support for output in standard graphic formats seems a
> glaring
> omission in a package geared towards imaging work. Are there any plans
> for
> improvements in this area in future releases?
The only glaring omission is in seeing the write_gif and write_jpg
procedures :-) Check your reference manual or online help for these
procedures, as well as several others such as write_srf, write_pict,
write_bmp, etc.
--
Mike Schienle Interactive Visuals
mgs@ivsoftware.com http://www.ivsoftware.com
|
|
|
Re: Support for image formats [message #12782 is a reply to message #12779] |
Thu, 10 September 1998 00:00  |
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.
|
|
|
Re: Support for image formats [message #12784 is a reply to message #12779] |
Thu, 10 September 1998 00:00  |
Matthew J. Sheats
Messages: 19 Registered: September 1997
|
Junior Member |
|
|
> Are there any routines for outputting 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.
Well what you could do, (Or at least what I would end up doing), is
once you have your plot displayed in your window as you want it, just do
a:
write_gif, pickfile(), tvrd()
(I don't know how much experience you have, sorry if I insult you
here). But
that will pop up a file dialog to pick where you want to save the image
and by what name,
and then it will read your plot off the window and store it in that gif.
Sometimes if you are using a speacial color table, the colors won't
stick in the
gif. (At least in 5.0, I haven't played with it a whole lot in 5.1 or
5.2). You may
also need to get the color table and send it to write_gif explicitly.
Like:
TVLCT, R, G, B, /GET
write_gif, pickfile(), tvrd(), R, G, B
Does this help any? (btw, there is support for jpg's, tif's and others
using the
same method). Just look up the write_ functions.
Hope this helps.
Matt Sheats
Los Alamos National Laboratory
sheats@lanl.gov
|
|
|