作者:潇湘V烟雨 | 来源:互联网 | 2023-07-29 07:13
IwanttorotateandsavemyCapturedImageusingAndroidNativeCameratosdcard.Asnativecameras
I want to rotate and save my Captured Image using Android Native Camera to sdcard. As native cameras is in landscape by default. But the I don't want to use bitmap. Is it possible to do so ? please help. I am new to android development.
我想用安卓自带的相机到sdcard来旋转和保存捕获的图像。在默认情况下,原生相机在景观中。但是我不想使用位图。有可能这样做吗?请帮助。我是android开发的新手。
As my image is rotated by 90 degrees I need to rotate it using Bitmap before saving. But on some devices bmp is coming null.
当我的图像旋转90度时,我需要在保存之前使用位图旋转它。但是在某些设备上,bmp是零。
Camera Activity Layout
相机活动布局
ManifestFile
ManifestFile
Camera Activity.java
相机Activity.java
FileOutputStream fos = new FileOutputStream(pictureFile);
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
Matrix matrix = new Matrix();
matrix.postRotate(90);
bmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
bmp.compress(Bitmap.CompressFormat.JPEG, 100,fos);
1 个解决方案