We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在使用analyzeBitmap方法解析图片时,可以加入图片旋转角度的判断,从而使解析的bitmap不被旋转导致条形码解析报错 public static int readPictureDegree(String imageFilePath) { int degree = 0; try { ExifInterface exifInterface = new ExifInterface(imageFilePath); int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: degree = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: degree = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: degree = 270; break; } } catch (IOException e) { e.printStackTrace(); } return degree; }
Matrix matrix = new Matrix(); matrix.reset(); matrix.setRotate(readPictureDegree(imageFilePath)); bmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在使用analyzeBitmap方法解析图片时,可以加入图片旋转角度的判断,从而使解析的bitmap不被旋转导致条形码解析报错
public static int readPictureDegree(String imageFilePath) {
int degree = 0;
try {
ExifInterface exifInterface = new ExifInterface(imageFilePath);
int orientation =
exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
}
} catch (IOException e) {
e.printStackTrace();
}
return degree;
}
Matrix matrix = new Matrix();
matrix.reset();
matrix.setRotate(readPictureDegree(imageFilePath));
bmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
The text was updated successfully, but these errors were encountered: