java - Exception thrown while converting large sized jpg images -
After
I'm trying to upload jpg upload ; Converting through servlet to the same new thumbnail After writing that file to disk, my requirment is to create a thumbnail for the same jpg file. And for this, I used the following code ... The code above gets well for small files but when it comes to the file of 5MB It has copies, but it fails to convert it to thumbnails & amp; amp; Throws Please guide me. You can increase the stack size of Java for '-Xms' and interpreter Check out this blog entry
// Code to upload & amp; The disk goes here when you write the image file. BufferedImage img = new BufferedImage (100, 100, BufferedImage.TYPE_INT_RGB); . Img.createGraphics () drawImage (ImageIO.read (new File (sourcefile)) getScaledInstance (100, 100, Image.SCALE_SMOOTH), 0,0, null.); ImageIO.write (IMG, "jpg", new file (thumbfile));
Thread Exceptions "" http-bio-8888 "-exec-63" java.lang.OutOfMemoryError: Java heap space java.awt.image.DataBufferByte. & Lt; Init & gt; In (Unknown Source) JavakawtkimagekComponentSampleModelkcreateDataBuffer (Unknown Source java.awt.image.Raster.createWritableRaster on javax.imageio.ImageTypeSpecifier.createBufferedImage on JavaxkimageiokImageReader) (Unknown Source) (Unknown Source) . On GetDestination (Unknown Source) ComksunkimageiokpluginskjpegkJPEGImageReaderkreadInternal (Unknown Source com.sun.imageio.plugins.jpeg.JPEGImageReader.read on JavaxkimageiokImageIOkread) (unknown source) ( Unknown Source) on UploadFile.doPost at javax.imageio.ImageIO.read (Unknown Source) (UploadFile.java:67).
- Using the Xmx command line option (sets the initial hep size and maximum heap size respectively).
Comments
Post a Comment