Questions tagged [bitmap]

Data structure for encoding pictures as a set of bits, in which each image pixel is mapped to a bit or a group of bit. Also used for encoding other complex data where each elementary information is mapped to bits, in a similar fashion. For platform specific bitmap API, prefer more specific tags (e.g. android-bitmap or nsbitmapimagerep).

A is a general data structure that maps complex data to a large set of bits. Each elementary information is mapped to specific bits.

Bitmaps are mostly used to encode graphic data and images. Each image pixel is mapped to a bit (black & white image) or a group of bits (grey scale or color image).

Usage guidelines:

External references:

15713 questions
165
votes
13 answers

Getting Bitmap from vector drawable

In my application, I have to set a large icon for a notification. LargeIcon must be a Bitmap, and my drawables are vector images (the new feature in Android, see this link) The problem is when I try to decode a resource that is a vector image, I get…
liltof
  • 2,153
  • 2
  • 14
  • 23
162
votes
10 answers

Android Crop Center of Bitmap

I have bitmaps which are squares or rectangles. I take the shortest side and do something like this: int value = 0; if (bitmap.getHeight() <= bitmap.getWidth()) { value = bitmap.getHeight(); } else { value = bitmap.getWidth(); } Bitmap…
Maurice
  • 6,413
  • 13
  • 51
  • 76
160
votes
13 answers

java.lang.OutOfMemoryError: bitmap size exceeds VM budget - Android

I developed an application that uses lots of images on Android. The app runs once, fills the information on the screen (Layouts, Listviews, Textviews, ImageViews, etc) and user reads the information. There is no animation, no special effects or…
Daniel Benedykt
  • 6,496
  • 12
  • 51
  • 73
156
votes
13 answers

Converting a view to Bitmap without displaying it in Android?

I will try to explain what exactly I need to do. I have 3 separate screens say A,B,C. There is another screen called say HomeScreen where all the 3 screens bitmap should be displayed in Gallery view and the user can select in which view does he…
sunil
  • 9,541
  • 18
  • 66
  • 88
154
votes
20 answers

Android: Bitmaps loaded from gallery are rotated in ImageView

When I load an image from the media gallery into a Bitmap, everything is working fine, except that pictures that were shot with the camera while holding the phone vertically, are rotated so that I always get a horizontal picture even though it…
Manuel
  • 8,135
  • 10
  • 32
  • 29
150
votes
6 answers

Convert Bitmap to File

I understand that using BitmapFactory can convert a File to a Bitmap, but is there any way to convert a Bitmap image to a File?
Mxyk
  • 10,678
  • 16
  • 57
  • 76
138
votes
4 answers

Remove the image from a imageview Android

I'm trying to make an ImageView that holds a gallery of images. By touching the user request to load the next image. If the next image isn't found in the server or takes time to load I need the old image to be empty. setVisibility(View.GONE) or…
ChyBy
  • 1,655
  • 2
  • 13
  • 15
134
votes
2 answers

How to convert image file data in a byte array to a Bitmap?

I want to store image in SQLite DataBase. I tried to store it using BLOB and String, in both cases it store the image and can retrieve it but when i convert it to Bitmap using BitmapFactory.decodeByteArray(...) it return null. I have used this…
Vasu
  • 2,673
  • 5
  • 20
  • 17
121
votes
1 answer

Image to ASCII art conversion

Prologue This subject pops up here on Stack Overflow from time to time, but it is removed usually because of being a poorly written question. I saw many such questions and then silence from the OP (usual low rep) when additional information is…
Spektre
  • 49,595
  • 11
  • 110
  • 380
119
votes
4 answers

What Haskell representation is recommended for 2D, unboxed pixel arrays with millions of pixels?

I want to tackle some image-processing problems in Haskell. I'm working with both bitonal (bitmap) and color images with millions of pixels. I have a number of questions: On what basis should I choose between Vector.Unboxed and UArray? They are…
Norman Ramsey
  • 198,648
  • 61
  • 360
  • 533
119
votes
2 answers

Creating an empty bitmap and drawing though canvas in Android

I'd like to create an empty bitmap and set a canvas to that bitmap and then draw any shape on the bitmap.
Sunil Pandey
  • 7,042
  • 7
  • 35
  • 48
118
votes
2 answers

Most memory efficient way to resize bitmaps on android?

I’m building an image-intensive social app where images are sent from the server to the device. When the device has smaller screen resolutions, I need to resize the bitmaps, on device, to match their intended display sizes. The problem is that…
Colt McAnlis
  • 3,846
  • 3
  • 18
  • 19
116
votes
6 answers

Failed binder transaction when putting an bitmap dynamically in a widget

Can anybody tell me the reason for failed binder transaction error? I can see this error message in logcat. I am getting this error while trying to put an bitmap dynamically in a widget...
Eby
  • 2,769
  • 4
  • 23
  • 30
113
votes
10 answers

android: create circular image with picasso

The question had been asked and there had been a promise made for the very version of Picasso that I am using: How do I send a circular bitmap to an ImageView using Picasso? I am new to Picasso and only thing I have used is…
Katedral Pillon
  • 14,534
  • 25
  • 99
  • 199
113
votes
10 answers

How to resize Image in Android?

I am creating an application and want to setup a gallery view. I do not want the images in the gallery view to be full size. How do I resize images in Android?
Jignesh Ansodariya
  • 12,583
  • 24
  • 81
  • 113