We are trying to load a JPEG of about 300kb in a 3120Classic(S40) and in the load moment our device run out of memory(as described by the exception). In a device of S60(N73) we don't have this kind of problem, so we believe that problem is the limited heap size of the S40 devices. The apps is something like a file navigator, where the user select between a thumbs to see a image in his real size, but we couldn't load the image because of the exception.
We have tried some optimizations in the source, but without great success. So, our last idea is to load just a part of the JPEG. We have thought two ways to do this:
1. Load a part with the Image class. The problem here is that to do this, the image have to be loaded a lest once, which are not possible;
2. Head bytes of the image with a stream and "collect" just the bytes of a desired part of the image. Doing some research, we found some documentation(http://en.wikipedia.org/wiki/JPEG) about JPEG files, but we can't understand how to get just de bytes of image data.
Is this possible? Did you have done something like this, and can give us some tips? Our could point us to a java documentation about bytes and possibly JPEG encode.
Thanks for your time reading this.