Closed LiTe1991 closed 7 years ago
Hello Lite1991,
Sure, glad to help you, There is some filter that I forget to remove the method recycle(). Send me the code plz.
for(int i = 0; i < scanResult.getTotal(); i++) { try { File outputFile = File.createTempFile("_temp", i + ".img", outputDir); FileUtils.copyFile(scanResult.getFile(i).getPath(), outputFile.getPath()); scanResult.getFile(i).delete(); ScannActivity.results.add(outputFile.getPath()); } catch (IOException e) { e.printStackTrace(); } Bitmap result = BitmapFactory.decodeFile(ScannActivity.results.get(0)); //System.out.println("Width: " + result.getWidth() + " Height: " + result.getHeight());
Log.i("IMAGE_START: ", Long.toString(System.currentTimeMillis()));
FastBitmap fastBitmap = new FastBitmap(result);
Log.i("ZEIT_MESSUNG_START", Long.toString(System.currentTimeMillis()));
Crop crop = new Crop(0, 0, WIDTH, HEIGHT);
crop.ApplyInPlace(fastBitmap);
Rotate rotate = new Rotate(180.00);
rotate.applyInPlace(fastBitmap);
Resize resize = new Resize((WIDTH * 2) / 3, (HEIGHT * 2) / 3);
resize.applyInPlace(fastBitmap);
ScannActivity.testResult = fastBitmap.toBitmap();
if(fastBitmap != null)
fastBitmap.recycle();
if(result != null)
result.recycle();
I mean in this way it has to work.
In the rotate and resize I was calling the method recycle wrong. Now is fixed.
Try to recompile the lib and run.
Okay thank you, but i get a new Exception durin "FastBitmap fastBitmap = new FastBitmap(...);
java.lang.OutOfMemoryError 07-01 15:35:51.250 6557 6612 E AndroidRuntime:
at Catalano.Imaging.FastBitmap.refresh(FastBitmap.java:161)
07-01 15:35:51.250 6557 6612 E AndroidRuntime:
at Catalano.Imaging.FastBitmap.
Or it´s my misstake?
The exception "java.lang.OutOfMemoryError" occurs depending on the version of Android, image size and the amount of ram of the smartphone.
Can i increas the ram size by code?
What is the size of the image and the android version ?
Image information: -11.07 MB
I have android 4.2.2(API 17)
Hi Diego, I have a general question maybe you cann help me? I want to save a Bitmap as 1 Bit Tiff and edit the EXIF Data, do you know how that works?
Currently java doesn't support tiff images, try to use TwelveMonkeys, this lib can support metadata edit.
Hi Diego,
can you maybe explane why your framework is so powerfull against standard java functions?
@LiTe1991 I have solved the out of memory exception.
Just add this code in your Android Manifest file.
android:largeHeap="true"
Anyway, ill port the filters to NDK in the future :)
HI Diego,
I use your nice Framework, but now as I switch to android I get a exception during fastBitmap.toBitmap(). Exception is: java.lang.IllegalStateException: Can't call setPixels() on a recycled bitmap 07-01 09:42:18.942 12791 13040 E AndroidRuntime: at android.graphics.Bitmap.checkRecycled(Bitmap.java:243) 07-01 09:42:18.942 12791 13040 E AndroidRuntime: at android.graphics.Bitmap.setPixels(Bitmap.java:1250) 07-01 09:42:18.942 12791 13040 E AndroidRuntime: at Catalano.Imaging.FastBitmap.toBitmap(FastBitmap.java:854)
Can you help me? Maybe it´s a problem because i recycle the Bitmap to fast?