1

我有拍照的应用程序。我的问题是保存在设备上的图像方向。我使用多种方法解决预览方向问题,但对保存在设备上的图像没有影响。我用来解决问题的方法:

Camera.Parameters parameters = camera.getParameters();
parameters.set("orientation", "portrait");
camera.setParameters(parameters);

&

mCamera.setDisplayOrientation(90);

&

mCamera.setDisplayOrientation(90);
mParameters = mCamera.getParameters();
mParameters.setRotation(90);
mCamera.setParameters(mParameters);

& 在 AndroidMainfest.xml 中

android:screenOrientation="portrait"

以及在android开发者官方网站上描述的方法,它说:“如果你想让相机图像显示在与显示器相同的方向,你可以使用以下代码”在这个地址: here

所有这些方法都适用于相机预览方向,但不适用于保存的图像。我也不想用这个:

String path = pictureFile.getPath().toString();
Bitmap bmp = BitmapFactory.decodeFile(path);
Matrix matrix = new Matrix();
matrix.postRotate(90);
bmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);

因为这种方法使用保存的图像并将其旋转并再次保存并降低图像质量。除了这种方法还有什么想法吗?谢谢

4

0 回答 0