Large Image

In what way can I LOAD large image in swing application?ImageIO give me memory error.
[99 byte] By [jproga] at [2007-11-26 14:44:11]
# 1
Increase VM memory settings using Xmx VM flag
kirillga at 2007-7-8 8:31:52 > top of Java-index,Security,Cryptography...
# 2

I have just increased memory to 384 mb but it doesnt work . because my Image is very large in photoshop it is 256mb of memoryof logical memory. I have to do a graphical application and I ?br>doesnt know what image people whant to process ,in this way I have to implement a robust system

of loading image .In java I doesnt know how to do it. can you help me

jproga at 2007-7-8 8:31:52 > top of Java-index,Security,Cryptography...
# 3
you could try to load it as different image type, however I don't know how ... sorry.
linuxhippya at 2007-7-8 8:31:52 > top of Java-index,Security,Cryptography...
# 4
Maybe you can use the "Memory-mapped files",in this way,you can load very big files(up to 2 GB).
Eastsuna at 2007-7-8 8:31:52 > top of Java-index,Security,Cryptography...
# 5
whot means memory mapped file?
jproga at 2007-7-8 8:31:52 > top of Java-index,Security,Cryptography...
# 6

[quote]

Memory-mapped files allow you to create and modify files that are too big to bring into memory. With a memory-mapped file, you can pretend that the entire file is in memory and that you can access it by simply treating it as a very large array. This approach greatly simplifies the code you write in order to modify the file. Here抯 a small example: Feedback

//: c12:LargeMappedFiles.java

// Creating a very large file using mapping.

// {RunByHand}

// {Clean: test.dat}

import java.io.*;

import java.nio.*;

import java.nio.channels.*;

public class LargeMappedFiles {

static int length = 0x8FFFFFF; // 128 Mb

public static void main(String[] args) throws Exception {

MappedByteBuffer out =

new RandomAccessFile("test.dat", "rw").getChannel()

.map(FileChannel.MapMode.READ_WRITE, 0, length);

for(int i = 0; i < length; i++)

out.put((byte)'x');

System.out.println("Finished writing");

for(int i = length/2; i < length/2 + 6; i++)

System.out.print((char)out.get(i));

}

} ///:~

[/quote]

The above is quote from <Thinking in Java, 3rd ed. Revision 4.0> ,chapter 12.

Eastsuna at 2007-7-8 8:31:52 > top of Java-index,Security,Cryptography...