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

[Bug]: Incorrect rotation shown in "Edit Image" #5711

Open
mnalis opened this issue May 5, 2024 · 3 comments · May be fixed by #5760
Open

[Bug]: Incorrect rotation shown in "Edit Image" #5711

mnalis opened this issue May 5, 2024 · 3 comments · May be fixed by #5760
Assignees
Labels

Comments

@mnalis
Copy link
Contributor

mnalis commented May 5, 2024

Summary

After clicking "Edit Image", picture (always?) seems to be in incorrect orientation (rotated 90 degrees counter-clockwise).

There is related issue #5502, but I'm not sure if that applies?

Steps to reproduce

  1. share picture to Commons app (or in Commons app choose to add picture from gallery)
  2. notice the picture is correctly oriented on main view (in Step 1 of 4: Media Details page)
  3. click Edit Image

Expected behaviour

expect that after clicking Edit Image, image will be shown in the same (correct) orientation that is was shown in step 2. above

Actual behaviour

image is shown rotated 90 degrees CCW.

Device name

Samsung Galaxy S23+

Android version

Android 14 (OneUI 6.1)

Commons app version

5.0.1~af028cbdd (latest F-droid)

Device logs

2024-05-04 21:34:51,674     [DEBUG] [file-logging-thread-1] [UploadMediaDetailAdapter$ViewHolder] : Description language code is: hr
2024-05-04 21:38:13,568     [DEBUG] [file-logging-thread-1] [EditActivity] : Rotation 0
2024-05-04 21:38:13,569     [DEBUG] [file-logging-thread-1] [EditActivity] : new Rotation 90
2024-05-04 21:39:26,319     [DEBUG] [file-logging-thread-1] [LocationServiceManager] : on location changed
2024-05-04 21:39:28,315     [DEBUG] [file-logging-thread-1] [LocationServiceManager] : on location changed
2024-05-04 21:39:29,322     [DEBUG] [file-logging-thread-1] [LocationServiceManager] : on location changed
2024-05-04 21:39:30,316     [DEBUG] [file-logging-thread-1] [LocationServiceManager] : on location changed
2024-05-04 21:39:32,313     [DEBUG] [file-logging-thread-1] [LocationServiceManager] : on location changed
2024-05-04 21:40:24,317     [DEBUG] [file-logging-thread-1] [LocationServiceManager] : on location changed

Screen-shots

small_Screen_Recording_20240504_213904_Commons.mp4

Would you like to work on the issue?

None

@mnalis mnalis added the bug label May 5, 2024
@acemarco1311
Copy link

acemarco1311 commented Jun 19, 2024

I have a similar issue, but mine got automatically rotated after the edit window (auto rotate when edit image without any further rotation), I think this is rooted from this piece of code in EditActivity.kt

var imageRotation = 0
val rotation = imageRotation % 360
val  newRotation = rotation + 90

then imageRotation will be changed based on newRotation

imageRotation = newRotation % 360

@nicolas-raoul can I work on this problem?

@acemarco1311
Copy link

Even though I cannot reproduce the exact problem (rotated immediately after the Edit Image click), the error on my testing machine is that after clicking "Edit Image" then perform no rotation (click "Save" or "Rotate" 4 times so that the picture gets back to the original position then click "Save"), the image will be rotated 90 degree.

Originally, I thought the problem was the logic in EditActivity.kt that somehow triggers rotation without clicking "Rotate". However, the problem is in the implementation of rotateImage() function in TransformImageImpl". The rotateImage()` function expects 90, 180, 270 for rotation, however, when the given rotating degree = 0 (user perform no rotation), the implementation assume it should be rotated 90 degree.

@nicolas-raoul PR #5760 might helps, thanks a lot!

@nicolas-raoul
Copy link
Member

@acemarco1311 Did you get a chance to check my pull request comment at #5760 (comment) ? :-)

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

Successfully merging a pull request may close this issue.

4 participants
@nicolas-raoul @mnalis @acemarco1311 and others