Results 1 to 3 of 3
Thread: Displaying large images
- 01-20-2009, 01:02 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 2
- Rep Power
- 0
Displaying large images
Hi,
A typical image I want to display ( and be able to scroll around ) is 20 Mb, 10000 x 5000 pixels, png format.
Trying to load such an image, I get Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
despite increasing the heap space available to the runtime environment with:
(Eclipse)
-vmargs
-Xms512m
-Xmx1024m
-XX:+UseParallelGC
-XX:PermSize=256M
-XX:MaxPermSize=512M
in the eclpise.ini file
I have tried loading just a portion of the image and this works:
File file = new File(ChartInfo.chartDir + "\\"
+ currentChart.getFileName());
ImageInputStream iis = ImageIO.createImageInputStream(file);
Iterator readers = ImageIO.getImageReadersByFormatName("png");
reader = (ImageReader) readers.next();
reader.setInput(iis, true);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
viewRectangle = new Rectangle(dim);
ImageReadParam readParam = reader.getDefaultReadParam();
readParam.setSourceRegion(viewRectangle);
However, the image takes 5 seconds to load. Scrolling to a different part of the image takes just as long.
Any suggestions most welcome.
Thanks,
John
- 01-21-2009, 09:07 AM #2
I don't use Eclipse, but doesn't changing runtime parameters in the ini file only affect Eclipse itself and not the application run from Eclipse?
In NetBeans, the parameters with which an application is run are set from the project properties. I imagine Eclipse would have something similar.
db
- 01-21-2009, 09:20 PM #3
Member
- Join Date
- Jan 2009
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
displaying uploaded images on the browser
By newton in forum Web FrameworksReplies: 3Last Post: 03-31-2011, 10:56 AM -
Code too large for try statement
By vravindran in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 01-09-2009, 11:49 AM -
Compare 2 large files
By bezudar in forum Advanced JavaReplies: 3Last Post: 11-23-2008, 02:18 AM -
[SOLVED] Need help in displaying images
By kirly in forum Advanced JavaReplies: 3Last Post: 10-21-2008, 05:36 AM -
Images not displaying in JSP in IE7
By chadscc in forum Advanced JavaReplies: 0Last Post: 11-13-2007, 03:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks