Since you have not posted your code, it is difficult to find out if there is a bug or probably inefficient code that can be improved.
But, as a rule, JVM memory is limited, so loading a large image can raise an OutOfMemoryError
. You can try to increase the JVM memory with the -Xmx
option. This is the first and easiest way.
Another way is to reduce your image (if possible). Or perhaps use a format other than BMP (e.g. JPG). It guarantees good quality and requires less memory.
source share