Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formats supported by BitmapFactory.decodeByteArray(...)

Is it documented (or reasonable to assume) that BitmapFactory.decodeByteArray(...) can be expected to recognize any of the image formats listed here?

like image 762
Brodo Fraggins Avatar asked Jun 20 '14 18:06

Brodo Fraggins


People also ask

What is BitmapFactory?

The BitmapFactory creates a bitmap object with this image and we use the ImageView. setImageBitmap() method to update the ImageView component. 2) From an Input stream. Use BitmapFactory. decodeStream() to convert a BufferedInputStream into a bitmap object.

What is DecodeStream in Android?

DecodeStream(Stream)Decode an input stream into a bitmap.


1 Answers

Yes, it's reasonable to assume (a bit more so if you take a peek at the source code of AOSP). The JNI native methods for BitmapFactory are in BitmapFactory.cpp.

https://github.com/android/platform_frameworks_base/blob/master/core/jni/android/graphics/BitmapFactory.cpp

Since both BitmapFactory.decodeByteArray() and the BitmapDrawable(InputStream) constructor end up calling doDecode(), and since this constructor is used when loading resources from the APK, it would be reasonable to assume that the capabilities are the same.

like image 179
matiash Avatar answered Oct 16 '22 14:10

matiash