Skip to content Skip to sidebar Skip to footer

Processing 1920x1280 Image With Android - Renderscript

I am newbie to RenderScript and trying to process image with size 1920x1280px, this seems to be crashing every time with following error on logcat 09-04 19:26:04.670: D/dalvikvm(30

Solution 1:

There is no exception or warning in your LogCat but I may know the issue.

First off, I didn't even look at your RenderScript because you said it works fine for small bitmap.

In android each VM or process have its own portion of memory and this is mostly not enough for a bitmap 1920x1080. So your logcat should have prompt something like this that you may have neglected:

bitmap size exceeds VM budget

I don't know your implementation details (getting bitmap form server, local file etc.). So I will guide you to Android Bitmap Training.

The general idea is to load image as small as you need. By this:

BitmapFactory.Optionsoptions=newBitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), R.id.myimage, options);
intimageHeight= options.outHeight;
intimageWidth= options.outWidth;
StringimageType= options.outMimeType;

The crucial part:

options.inJustDecodeBounds = true;

Says hey! don't decode and load the bitmap yet. I will do some settings to my Bitmap.

Post a Comment for "Processing 1920x1280 Image With Android - Renderscript"