Skip to content
New issue

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

Image rotation issue fixed on Samsung(S) devices. #169

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mak12
Copy link

@mak12 mak12 commented Jul 21, 2020

While working on a project, we figured library wasn't working as expected on Samsung(S) devices i.e when we were trying to sketch on image images was being rotated on canvas, so I decided to fork and solve the issue using ExifInterface. I got the exact rotation of image and then rotated the bitmap that's going on canvas. We tested this code on multiple devices both android and iOS and is working fine.

Comment on lines +473 to +482
ExifInterface exif = null;
try {
exif = new ExifInterface(backgroundURI.getPath());
} catch (IOException e) {
e.printStackTrace();
}

int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);

Bitmap newBitmap = rotateBitmap(bitmap, orientation);
Copy link

@Kichiyaki Kichiyaki Oct 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fragment should be wrapped in the if statement that checks if backgroundURI is null (currently, you can't save an image without background).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, check is added now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants