Bitmap too large to be uploaded into a texture (3000x1547, max=2048x2048)

242 views Asked by At

I loaded a bitmap image from my database but wen I am stretching my image its returning me blur image and I am getting this error

"Bitmap too large to be uploaded into a texture (3000x1547, max=2048x2048)"

BitmapFactory.Options options = new BitmapFactory.Options();

    options.inSampleSize = calculateInSampleSize(options, 3000 ,
            1574);

    Display mDisplay = (getActivity()).getWindowManager()
            .getDefaultDisplay();

    bitmap = BitmapFactory.decodeByteArray(map, 0, map.length, options);

     image.setImageBitmap(Bitmap.createScaledBitmap(bitmap,2048,1500,
     false));
    public static int calculateInSampleSize(BitmapFactory.Options options,
        int d, int e) {

    final int height = options.outHeight;
    final int width = options.outWidth;
    int inSampleSize =  1;

    if (height > e || width > d) {

        final int halfHeight = height / 2;
        final int halfWidth = width / 2;

        // Calculate the largest inSampleSize value that is a power of 2 and
        // keeps both
        // height and width larger than the requested height and width.
        while ((halfHeight / inSampleSize) > e
                && (halfWidth / inSampleSize) > d) {
            inSampleSize *= 2;
        }
    }

    return inSampleSize;
}
0

There are 0 answers