Implementation code of mutual conversion between Android picture types
•
Android
This example describes the implementation code of mutual conversion between Android image types. Share with you for your reference. The details are as follows:
Android will perform some types of conversion when processing image resources. Now I have time to sort it out:
1、Drawable → Bitmap
The Java code is as follows:
2. Get bitmap from resource
The Java code is as follows:
3、Bitmap → byte[]
The Java code is as follows:
4、 byte[] → Bitmap
The Java code is as follows:
The above are some transformations I have encountered in practice. If I encounter similar ones in the future, I don't have to look everywhere.
I hope this article will be helpful to your Android program design.
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码