need robust tobufferedImage() method
this method converts Image to BufferedImage.
private BufferedImage toBufferedImage(Image image,int type){
int w = image.getWidth(null);
int h = image.getHeight(null);
BufferedImage result =new BufferedImage(w, h, type);
Graphics2D g = result.createGraphics();
g.drawImage(image, 0, 0,null);
g.dispose();
return result;
}
it works good for image files that aren't compressed.
however when i try it with a compressed 8MB tiff file it throws the following exception:
java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferInt.<init>(Unknown Source)
at java.awt.image.Raster.createPackedRaster(Unknown Source)
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at java.awt.image.BufferedImage.<init>(Unknown Source)
at upload.ImageProcessor.toBufferedImage(ImageProcessor.java:243)
at upload.ImageProcessor.Crop(ImageProcessor.java:188)
what could be the problem ?
how can i write a robust tobufferedImage() method that supports tiff compressed files?
thanks.

