Is it documented (or reasonable to assume) that BitmapFactory.decodeByteArray(...) can be expected to recognize any of the image formats listed here?
Asked
Active
Viewed 4,713 times
12
-
Yes (reasonable to assume). But WebP is only for Android 4.0+. PNG, JPG, GIF (... BMP ??) are common formats for Android. If the can be used as backgrounds, it's reasonable to assune that BitmapFactory will handle them. – Phantômaxx Jun 20 '14 at 18:32
-
One would have thought that the BitmapFactory documentation would contain this information. That lack of documentation led me to find this question. – Brain2000 Feb 21 '17 at 15:16
1 Answers
13
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
.
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.

matiash
- 54,791
- 16
- 125
- 154