Questions tagged [android-bitmap]

A Java Object from android.graphics.Bitmap that represents a Bitmap.

Use android.graphics.Bitmap to create an immutable bitmap image for Android.

Android supports bitmap files in three formats:

  1. .png (preferred),
  2. .jpg (acceptable),
  3. .gif (discouraged).

To find more information :

1782 questions
37
votes
6 answers

How do you get the RGB values from a Bitmap on Android?

I want to get RGB values of a Bitmap on Android but I can't do this so far. My aim is to obtain RGB values for each pixel of a Bitmap. Is there any specific function for Android or anything else? Also I wonder that do I need colorMatrix()…
barzos
  • 837
  • 3
  • 16
  • 25
35
votes
7 answers

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference

I have BitmapScalingHelper.java: public class BitmapScalingHelper { public static Bitmap decodeResource(Resources res, int resId, int dstWidth, int dstHeight) { Options options = new Options(); options.inJustDecodeBounds =…
32
votes
6 answers

Error : RuntimeException at DisplayListCanvas.throwIfCannotDraw

My application work very well on nougat emulator and many devices, but i found this exception in google play crash reporter, I don't know why it happened, The exception causes with nougat devices ++ only. the exception : …
user7913931
31
votes
2 answers

How to get the height and width of an ImageView/Bitmap in Android

I want to get the height and width of an image bitmap that is either in ImageView or a background image. Please help me, any help will be appreciated.
abhishek ameta
  • 2,326
  • 7
  • 28
  • 35
31
votes
1 answer

How to load a Bitmap with Picasso without using an ImageView?

With ImageView, I can use the following code to download image with callback Picasso.with(activity).load(url).into(imageView, new Callback() { @Override public void onSuccess() { // do something } @Override public…
EES
  • 1,584
  • 3
  • 20
  • 38
31
votes
5 answers

BitmapFactory OOM driving me nuts

I've been doing a lot of searching and I know a lot of other people are experiencing the same OOM memory problems with BitmapFactory. My app only shows a total memory available of 4MB using Runtime.getRuntime ().totalMemory(). If the limit is…
Greg
  • 2,233
  • 4
  • 18
  • 7
28
votes
2 answers

Save Image From WebView

I will try to be short - so I'm making this app, where image is uploaded to custom Webview, draw canvas and save it. Now I successfully execute everything, up to the point of saving it. I've tried a lot of different methods, but none worked. I save…
Oleksandr Firsov
  • 1,428
  • 1
  • 21
  • 48
25
votes
3 answers

Is there a way to get URI of bitmap without saving it to sdcard?

I am making an app that allows the user to share an image using android intent but how to get that URI of a bitmap without need to saving it to sd card I have used this code that works fine, but I don't need to save this bitmap to sd card private…
Ahmed Mousa
  • 580
  • 1
  • 7
  • 22
24
votes
3 answers

How can I display a bitmap in Compose Image

I have a function that returns a bitmap (which "contains" a QR code) and I wanted to display that bitmap inside an Image (composable function) but I didn't find any way to either convert the bitmap into a ImageBitmap or just displaying that bitmap.
JustSightseeing
  • 1,460
  • 3
  • 17
  • 37
24
votes
2 answers

How to check if a Bitmap is empty (blank) on Android

How can I check if a Bitmap object is completely blank, i.e. all its pixels are transparent, without a x-y loop on every pixel?
lorenzo-s
  • 16,603
  • 15
  • 54
  • 86
22
votes
7 answers

Release Memory of Particular Activity when it is Destroyed

I have a launcher Activity that load and resize big bitmap as it's background when it opens. Whenever hit the back button, the Activity is destroyed. But I think the memory is not released yet. When I open back the app, hit the back button and open…
JayVDiyk
  • 4,277
  • 22
  • 70
  • 135
21
votes
1 answer

Bitmap getWidth returns wrong value

I have a jpg image in my android application drawable folder which resolution is 1000x600. I load that image to bitmap like this Bitmap bitMap = BitmapFactory.decodeResource(getResources(), R.drawable.image); After this I call bitMap .getWidth()…
narek.gevorgyan
  • 4,165
  • 5
  • 32
  • 52
21
votes
6 answers

How to convert Image to PDF?

I am developing an application where I need to convert an Image to PDF. I tried something, but the issue is, Image size in that PDF is very very small. I need solution to fix this. Also I am looking for converting multiple Images into single PDF…
Anish Kumar
  • 478
  • 4
  • 12
  • 27
20
votes
6 answers

Android Blur View (Blur background behind the view)

I am trying to make the bottom part of an Image blur for the view on top it like in the image. I tried blurring it using Rendenscript but I am not able to blur only the part behind the view. :( I have seen many libraries but almost all of them blur…
Atul O Holic
  • 6,692
  • 4
  • 39
  • 74
19
votes
0 answers

What's the use and advantages of using ImageDecoder of Android P?

Background Android P presents a new API for loading images, using ImageDecoder class. The problem Not much is documented about this class, so I'm just curious about its usage, and whether I should consider using it when possible, instead of Glide…
android developer
  • 114,585
  • 152
  • 739
  • 1,270