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
Related
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);
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.
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.
I would like to add an image (Bitmap) over another one. For that I am only using Bitmaps (fot the image I draw in and the image I add), but the Bitmap I am using is actually a resource in my drawable resource. So Is there a way to create a Bitmap that contains my drawable ?
Use decodeResource() of BitmapFactory to convert drawable resource into Bitmap as follows...
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.your_drawable);
Try this:
Bitmap bitmap= BitmapFactory.decodeResource(context.getResources(),
R.drawable.icon_name);
I am little bit confusing because i am calculate the size of of an image.
I am using the following code in android:-
String fileUrl = getIntent().getExtras().getString("fileurl");
BitmapFactory.Options option = new BitmapFactory.Options();
option.inPurgeable = true;
Bitmap bitmap= BitmapFactory.decodeFile(fileUrl,option);
Log.e("Fill Image Size in Bytes","====>"+bitmap.getByteCount());
The above function bitmap.getByteCount() return different value compare to original size of image(compare with right click of image size in ubuntu).
If anyone have idea.please reply.
Thanks in advance...
You can decode the bitmap without options to see what's the difference.
Bitmap bitmap= BitmapFactory.decodeFile(fileUrl);
Log.e("Fill Image Size in Bytes","====>"+bitmap.getByteCount());
the default value of options may scale down the size.
It may be decided by Bitmap.config and bitmap size.