Can you decode a mutable Bitmap from an InputStream?
Posted
by Daniel Lew
on Stack Overflow
See other posts from Stack Overflow
or by Daniel Lew
Published on 2010-04-30T18:48:15Z
Indexed on
2010/04/30
18:57 UTC
Read the original article
Hit count: 320
android
Right now I've got an Android application that:
- Downloads an image.
- Does some pre-processing to that image.
- Displays the image.
The dilemma is that I would like this process to use less memory, so that I can afford to download a higher-resolution image. However, when I download the image now, I use BitmapFactory.decodeStream()
, which has the unfortunate side effect of returning an immutable Bitmap. As a result, I'm having to create a copy of the Bitmap before I can start operating on it, which means I have to have 2x the size of the Bitmap's memory allocated (at least for a brief period of time; once the copy is complete I can recycle the original).
Is there a way to decode an InputStream into a mutable Bitmap?
© Stack Overflow or respective owner