I’m performing an OCR utility for Android and I’d like to crop an image on the fly, I mean, take the picture and in the JPEG callback be able to crop the image from the byte array Android returns to you before to save it or whatever.
The original issue is that I need to generate a bitmap from that image and, if it has high resolution, I’m getting a “Bitmap exceeds VM budget” error. Also I’d like to crop the image (automatically, not allowing the user to do it) because of processing time of the OCR.
I saw a BitmapRegionDecoder class from Android 2.3.3 forth that makes all I’d like to do, but I need to work with earlier versions. Any suggestions?
Thank you guys!
Finally I’ve realized the only two feasible options seem to be storing the photo in the SD card and work with it after or to use a native library (which memory allocation is done out of the Dalvik VM heap so you’re able to use up to 10 times more RAM than inside the VM). I think I’ll choose to store it first. Seems to be more simple to do and maintain.