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
0
votes
1 answer

How to know that Canvas has used bitmap object

Hi I am creating Bitmap object and using in canvas, like below code Bitmap result = Bitmap.createBitmap(loadedImage.getWidth(), loadedImage.getHeight(), Config.ARGB_8888); Canvas mCanvas = new Canvas(result); Paint paint = new…
Siddhpura Amit
  • 14,534
  • 16
  • 91
  • 150
0
votes
3 answers

ImageView shows nothing

I have a Bitmap (1538 x 2000) and set it as src of ImageView but when I run the app nothing shows up (but the activity background color), I read things about bitmap dimension limits, But if the problem is the limitation why I can view this bitmap by…
Farshad
  • 3,074
  • 2
  • 30
  • 44
0
votes
0 answers

Handling same image bitmap in different activities

I am changing 4 pixels of a bitmap in activity1 and in activity2 I want to obtain those particular pixel RGB values but I am getting different values for that what can be the reason? I have saved image in JPEG format from activity1 to gallery and…
Aalap Patel
  • 2,058
  • 2
  • 17
  • 31
0
votes
0 answers

Get specific two pixel from the bitmap for processing

I have an image on which I want to process pixel number 159 and 160 specifically. I am running this code but it gives me ArrayIndexOutOfBoundsException. I think the way I have declared that array that is the problem. int[] twoPositions = {159,…
Aalap Patel
  • 2,058
  • 2
  • 17
  • 31
0
votes
1 answer

android drawing to canvas and setting dpi

I created some test assets for ldpi up to xxxhdpi and put them in there respective drawable folders. If I draw things at the corners of the screen say position 0,0 or 0+canvas.getWidth()-bitmap.getWidth() or things like that they align properly…
user1610950
  • 1,837
  • 5
  • 33
  • 49
0
votes
1 answer

Smoothly Updating Bitmap

Just to add a surprise factor to my game, I have decided to invert the background colors randomly. When the player collects, let's say, 21 golden bacon strips the background changes. By modifying the bitmap's pixels, I have done this through the…
0
votes
1 answer

Why is Samsung Galaxy S6 (Lollipop) allocating 4 times the memory of older devices for bitmaps

I just started testing my game app on a new Samsung Galaxy S6. It kept crashing with out of memory errors in the log. My app normally uses about 215M and worked fine with the Galaxy S4 mini, Galaxy Tab S3, and Galaxy Tab S4, which have heaps of…
Androidcoder
  • 4,389
  • 5
  • 35
  • 50
0
votes
2 answers

How to adjust size of view according to its content

In my project, user is choosing an image from gallery which is then set as background of my custom View. And I need the size of that View to be adjusted to the size of the image. In current version, the size of my custom View is static. But I need…
user5465676
0
votes
0 answers

BitmapFactory.decode() produce file not found error after picking image from gallery

Decoding image file received from Media.EXTRA_OUTPUT in action_pick intent produce file not found exception. I see a lot of similar questions regarding to this but still can't figure out the issue. I face this issue in android Gallery app below…
Tixeon
  • 930
  • 1
  • 12
  • 27
0
votes
1 answer

Memory consumption in Android app exceeds the sum of all bitmaps

I have been building an Android game which loads, scales, and displays bitmaps. Whenever I start loading a batch of bitmaps, the memory profile of the game on my LG Nexus 4 skyrockets. Then when I start interacting with the game (touching the…
Joe
  • 376
  • 4
  • 13
0
votes
0 answers

New : Send Image from one activity to another activity

I have tried answers from Stack Overflow, but not working, getting null pointer. Things I have tried: MainActivity.java: public class MainActivity extends AppCompatActivity { ImageView ivSelectCardLogo; Button btnNext; private static…
tiger
  • 413
  • 1
  • 5
  • 18
0
votes
0 answers

Compress Bitmap before uploading

Im using Facebook-Parse to upload a bitmap to the server (so in this case I'd like to use PNG/JPEG format since WEBP gives an error). Im able to upload the image successfully, what I want to know is if it can be made more efficient and if I can…
Zen
  • 2,698
  • 4
  • 28
  • 41
0
votes
1 answer

How to draw 3 bitmaps in canvas

I am trying to merge 3 imageViews into one bitmap i am using canvas and here is the function private Bitmap createSingleImageFromMultipleImages() { Bitmap formBitmap = getBitmapFromImageView(formView); Bitmap idFrontBitmap =…
Christopher M.
  • 130
  • 1
  • 9
0
votes
2 answers

How to crop Bitmap on all four sides?

I'm trying to write a method that takes a Bitmap and the crop values as parameters and returns the cropped Bitmap. My code: public Bitmap applyCrop(Bitmap bitmap, int leftCrop, int topCrop, int rightCrop, int bottomCrop) { return…
anon
0
votes
1 answer

BitmapFactory.decodeResource() ignoring inScaled

It appears that BitmapFactory.decodeResource() is ignoring inScaled when inJustDecodeBounds is also "true". In this snip of code: Resources res = getResources (); DisplayMetrics metrics = res.getDisplayMetrics (); BitmapFactory.Options options =…
Peri Hartman
  • 19,314
  • 18
  • 55
  • 101