Picture is rotated 90 degrees after picking it with image picker

Hello. I am facing another hurdle on my way to completing my app. When I select an image in the gallery, it displays it with a 90 degrees rotation in the image component. this happens on 2 of my testing devices ( samsung android 12 and LG android 8) and not the others. After doing some searching I found that this is common behavior with those phones. i saw a few posts in the community about it but they all were related to taking a picture with the camera component and not selecting one with the image picker.
I tried some things to work around it. The only solution I could find was using a switch and when the switch was on if your devices rotated the pictures it will flip it 90 degrees back to normal using taifun image extension.

I am not satisfied with this solution tho and would like to figure out one where I wouldn't have to use a switch.
Any one has an idea?

Here is a simplified aia of what I am trying to achieve
rotate.aia (29.9 KB)

1 Like

Try rotating it back with this extension.

As I mentioned above I tried that. @Gordon_Lu

You want an automated solution ?

@TIMAI2 yes preferably. Unfortunately the switch gets in the way of the user experience and crowds an already crowded interface. Also there are other reasons for that. For example when the picture picked is from any other folder than the gallery ( messenger pics, downloads, ect....) the problem isn't there but the picture gets flipped any way with this solution.

An extension would be needed to analyse the exif data of the image, and carry out any necessary rotation/s. This is dependent on there being suitable exif data in the first place.

It may not be acceptable, but consider introducing an image editor option (rotate/crop/colourize/etc) for the user, prior to continuing with chunking ?

Along with Taifun's Image extension, perhaps @Gordon_Lu 's ImageUtils


@TIMAI2 Is there one you know of? My programming knowledge is very limited to the realm of MIT app inventor. And even then I have a ton more to learn. I don't know anything about exif data :disappointed_relieved:

or you could use javascript to run an exif js on the file

Thank you!

That might work! Indeed one thing I noticed is that if the picture selected was edited in any way prior to being picked the rotation issue did not happen. I just couldn't figure out how to edit the selected picture with the code prior to or while using the image picker @TIMAI2

You are aware that the imagePicker image supplied is a copy of the original image?

You might also be interested in this:

which I put together before Android 11+ file access issues came along

1 Like

Yeah I read about that in the Media docs which added to my confusion as to why the images were getting flipped. Am I missing something? @TIMAI2
Oh I think you mean I can edit it because it is a copy? If so what I was trying to say is I couldn't find any MIT app inventor component or block that would edit a image picker picked picture. @TIMAI2

Ooohhhh I will look at that too!!


1 Like