Maximum Bitmap height and width Supported in Android - android

I tried to get full size bitmap from drawable but not get.My image store into drawable folder and its sized 1082*1673 and when i get bitmap from drawable its sized 662*1024.
I tried to all possible changes
My code shown below
Bitmap bmp = BitmapFactory.decodeResource(getResources(),
R.drawable.t_0001, o);

Related

High resolution bitmap quality issue

I get bitmap from drawable but bitmap sized is maximum 1024*1024..i will try to get
bitmap full resolution from drawable but ican't get.I will try to all possibile work but not get how to solve this problem.I try to last 4 days but not get any proper solution.I want to need get full resolution bitmap from drawable
BitmapDrawable drawable = (BitmapDrawable) img.getDrawable();
Bitmap bmp = drawable.getBitmap();
Bitmap b = Bitmap.createScaledBitmap(bmp, 1025, 1025, false);
First, you need to put your image file in drawable-nodpi. nodpi will not resize your drawable.
Second, you can use BitmapFactory.decodeResource(getResources(), R.drawable.bg_pop); to retrieve Bitmap from resource.
Edit-
You can use 'inScaled' options when retrieving Bitmap from the resource. I checked from my project. (original image size is 1920x1080
val options= BitmapFactory.Options()
options.inScaled = false
val bitmap = BitmapFactory.decodeResource(resources, R.drawable.splatoon, options)
ScreenShot, in imgur

Get original size bitmap from drawable

I tried to get full size bitmap from drawable but not get.My image store into drawable folder and its sized 1082*1673 and when i get bitmap from drawable its sized 662*1024
I tried to all possible changes
My code shown below
[1] Bitmap icon = BitmapFactory.decodeResource(getResources(),R.drawable.t_0001);
[2] BitmapFactory.Options o = new BitmapFactory.Options();
o.inTargetDensity = DisplayMetrics.DENSITY_DEFAULT;
Bitmap bmp = BitmapFactory.decodeResource(getResources(),
R.drawable.t_0001, o);
Put that image must be in drawable-xxhdpi folder
I guess if you put your images under the Assets folder (or subfolder inside assets), the auto resize will not happen.

How to load a Bitmap in LAB color space?

Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.img);
This line loads an image in RGB. What about a LAB colors?
I found ColorSpace.Model.LAB constant but not how to use it.

Android:Load a Scaled Down Image into Memory

I used to use BitmapFactory.Options, inSampleSize and inJustDecodeBounds to load a scaled image in memory and not the sample Image...`Is this method load a scaled image in memory?
public void ScaledBitmap() {
Bitmap bMap;
ImageView iv;
iv=(ImageView)findViewById(R.id.my_image);
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize=4;
options.inJustDecodeBounds=true;
bMap=BitmapFactory.decodeResource(getResources(),R.drawable.my_image,options);
iv.setImageBitmap(bMap);
}
You have set options.inJustDecodeBounds=true;. This means that the decoded bitmap will be null. So bMap will be null.
UPDATE: When you give inJustDecodeBounds=true and decode the resource, you won't get any bitmap. This option is used only to get the real width and height of the image resource without decoding the image. Using this width and height, you can calculate the inSampleSize. Once you have calculated that, set the inSampleSize and set inJustDecodeBounds=false and decode the resource again. Now you will get the correct scaled bitmap.
You will find more info on how to effectively scale a bitmap here : http://developer.android.com/training/displaying-bitmaps/load-bitmap.html

How to set size of nine-patch drawable programmatically in android

This is how we can resize a normal bitmap drawable
Drawable d = getResources().getDrawable(R.drawable.error);
Bitmap bm = ((BitmapDrawable)d).getBitmap();
error_indicator = new BitmapDrawable(getResources(), bm.createScaledBitmap(bm, 50, 50, true));
But I want to know how to resize a nine patch drawable. since the above code doesnt works for me giving me ClassCastException saying NinePatchDrawable cannot be cast to BitmapDrawable.
This is nine-patch drawable(hdpi).I have other resolutions icons too
Draw 9-patch tool screenshot
App Screenshot

Categories

Resources