Is there a BitmapFactory permission to fix "Bitmap too Large to load it into a texture"?

on some devices, it seems that the Bitmap images are too large for the ImageView that is going to host them.

Images will be captured by camera and network. They will be shown 1 at a time in activity, which allows you to move the image, zoom, etc., to look at the defects.

It seems that when using images from the camera we get "Bitmap too large to be loaded into the texture."

I did not want to set the scale hard, but I thought of taking any image, and through Bitmap Factory to create an image that fits in Imageview. Then I would take this image, since it is not large, and a pinch scales it, linking the matrix with the ImageView.

+1
source share
1 answer

I looked around stackoverflow about how this can be solved. I came to the following conclusions:

As a final note, I did that I took a bitmap image and assigned it MATRIX, and then scaled the matrix to

 Matrix m = new Matrix(); m.postScale(scaleX,scaleY); 

which allows you to get a sample image to reduce it, and then scale it to maintain the same size. inSampleSize is the size of both scaleX and scaleY to zoom in.

Possible problem: pixelation. depending on the size of the image, it will not be so bad, but you will see some of them.

This is a solution to device limitations. I would see how wide the width and height of the images are, and if it's> GL_MAX_TEXTURE_SIZE, it will do some math and do it under balance.

and I believe the following standard things:

  • ...

  • Profit!

+1
source

All Articles