Re: saving images on a linux box

Hi Don,

Don Murray wrote:
Hi Ugo-

Ugo Taddei wrote:

A note for the archives. The following works with jdk1.4:

import javax.imageio.*;

...

FileOutputStream fos = new FileOutputStream(file);
ImageIO.write(display.getImage(),"JPG",fos);
fos.flush();
fos.close();

if you swap "JPG" for "PNG" the img is saved as such.


but then you are 1.4 dependent. ;-)

Yes, I'm aware of that. I should have said "the following works *only* on jdk1.4". I just wanted to add a note to the archives. I was experimenting with ImageIO because sometimes visad.util.Util.captureDisplay doesn't work. (Can't explain why. The display is showing, but the image doesn't get saved.)

  VisAD strives to be
1.2 dependent.  While there are many advantages to 1.4,
it is a space drain, it has problems with ATI graphics cards
on laptops, needs administrative privileges to install on
Windows XP,

This last point is certainly an issue with Windows XP and not with JDK 1.4!

and a stable version (1.4.2) is not available
on all platforms.  I'm not saying don't use it, but 1.4
can be fraught with "issues".

Yes, it's a shame. I use 1.3 and 1.4 (1.2 not anymore), but again, I don't have a hungry free-software community to feed and keep happy ;-)

Cheers,

Ugo

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************