saving grid to a jpeg file format

Hi All,

I have a grid created and i want to save it to the
file which is of either *.gif or *.jpeg format and
then open it when required.

I have created a grid on canvas which is  added to the
JDialog. I want to save it either in *.gif or *.jpeg
format. I tried to do something like this.

public void convertGridToImage() {
    BufferedImage image = display.getImage();
    try {
        JPEGEncodeParam param = 
JPEGCodec.getDefaultJPEGEncodeParam(image);
            param.setQuality(1.0f, true);
            FileOutputStream fout = new
FileOutputStream("c:/newtry.gif");
            JPEGImageEncoder encoder
JPEGCodec.createJPEGEncoder(fout);
            encoder.encode(image, param);
            fout.close();
        }
        catch (NoClassDefFoundError err) {
            throw new VisADException("JPEG codec not
found");
        }
        
    }

it gives the exception at this place
display.getImage();

I checked the captureImage() method in BasicSSCell
class, but these examples are too complicated for a
person who is still learning VisAD.

Is there any easy way to approach ? Please suggest.
 
Regards,
Karan Kapoor.

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: