Voi*_*icu 10
字节数组到位图:
Bitmap bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
Run Code Online (Sandbox Code Playgroud)
使用此选项通过提供直角(180)来旋转图像:
public Bitmap rotateImage(int angle, Bitmap bitmapSrc) {
Matrix matrix = new Matrix();
matrix.postRotate(angle);
return Bitmap.createBitmap(bitmapSrc, 0, 0,
bitmapSrc.getWidth(), bitmapSrc.getHeight(), matrix, true);
}
Run Code Online (Sandbox Code Playgroud)
然后回到数组:
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] flippedImageByteArray = stream.toByteArray();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7032 次 |
| 最近记录: |