Hello. I'm developing a camera application for nokia 6700 classic model.
I am using a generic method to get snapshot and image buffer as like this article (http://wiki.forum.nokia.com/index.ph...ic_using_MMAPI)
But when i call createImage function, OutOfMemory error occured. Because the application was worked well in other j2me phones (nokia, sony .. ), I think there is no logical mistake in my source.
I think this error occured because of too large snapshot buffer.
I measured size of snapshot buffer using the following method.
myImg = Image.createImage(jpgImg, 0, jpgImg.length);
jpgImg = midlet.cameraCanvas.videoControl.getSnapshot(null);
The size of snapshot buffer is about 35kbytes. I expect that the resolution of the image is 640*480.
And available memory which measured from
long freeMemory = runt.freeMemory();
is about 150kbytes. I think because 640*480 image require at least 640*480*3 = 921.6kbytes of memory, OutOfMemory error occured.
But i don't need the high resolution image like that. Even gray scale image of 160*120 size is enough for me. Actually, i have to do image processing on my image, to get raw buffer of small and gray scaled image directly is best for me.
So i tried to contol resolution of snapshot size like this,
jpgImg = midlet.cameraCanvas.videoControl.getSnapshot("encoding=jpeg&width=160&height=120");
but the size of snapshot buffer is still same. And "encoding=gray8" nor "encoding=rgb&colors=rgb888" is also worked.
Is there anyone who knows how to control the size of snapshot image?
If it is not available, to know how to get enough memory for using Image.createImage() for 640*480 image is also helpful for me. (I cannot believe there is available memory is only 150k even i spend some memory for other resource)