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

in Android: Image captured by camera is 90 degree rotated and cannot be properly displayed on a canvas #3330

Open
8 tasks
stezelMIT opened this issue Jan 17, 2025 · 3 comments

Comments

@stezelMIT
Copy link

Describe the bug

Affects
Using an Android tablet:
Image captured by camera is 90 degree rotated and cannot be properly displayed on a canvas. If you associate the image with an Image component then this Image can be rotated but then there is no way to pass this Image to a Canvas as a BackgroundImage. I don't understand why a captured image by default is 90 degree rotated and not WYSIWYG when image is captured.

In the community forum there is quite a bit of discussion on this and a lot of ingenious acrobatics and suggestions by power users but I cannot see how any of these are appropriate for young children just starting App Inventor.

iOS: the issue does not seem to happen in iOS and all images are properly displayed.

  • Designer
  • Blocks editor
  • Projects Explorer
  • Companion
  • Compiled apps
  • Buildserver
  • Debugging
  • Other... (please describe)

Expected behavior
Image taken should be displayed as it is not 90 degree rotated.

Steps to reproduce
Take image with camera and and try to paste it to a canvas.
This AIA file may help see the issue:

PhotoBooth.aia.zip

@patryk84a
Copy link
Contributor

patryk84a commented Jan 21, 2025

With my POCO phone running Android 14, I cannot reproduce this issue. Unless I don't understand your expectations. Could you make a screenshot showing the problem?

@ewpatton
Copy link
Member

The issue is related to the physical orientation of the camera in the hardware, so not all devices will exhibit the problem. The logic in MediaUtil for loading an image should take into account the EXIF orientation metadata in the JPG returned by the Camera app (relevant Stack Overflow thread).

@patryk84a
Copy link
Contributor

Yes I know what is going on with orientation, but I would like to see what exactly OP considers as incorrect behavior. Because in the example application, all image locations are vertical and in my case the camera image is always vertical, but when we take a picture with the phone rotated 90 degrees the resulting image is squeezed, so we should use fix size in image, so as not to change the aspect ratio of the image. As for rotation automation, I think it would be a better idea to return information about the angle of rotation of the image, then the developer can use it to properly orient the image or for other purposes.

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

No branches or pull requests

3 participants