Can you decode a mutable Bitmap from an InputStream?
- by Daniel Lew
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?