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

Implemented rotate image feature #885

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

Conversation

tognee
Copy link

@tognee tognee commented Jun 18, 2023

Pull request for issue #856

The orientation field contains the "Orientation" tag present in the file (if not present it will default to 1).
The localOrientation field is used to rotate the thumbnail without writing into the original file (by default is one).
Both use the EXIF orientation standard (numbers form 1 to 8) to describe how the image should be rotated.

The app by default rotates the thumbnails using the localOrientation field.
If the users wants to save the tags to the image, the orientation field is used and it is written into the file itself. Most (if not all) image viewers will see that tag and rotate the image accordly. This method is non-destructive on the images as this is a loseless rotation (the image doesn't get re-encoded).

The api/photosedit/rotate endpoint has been added and it accepts POST requests passing:

  • image_hash: The hash of the image that needs to be rotated
  • angle: A number that is a multiple of 90, that the image will be rotated by. If the number is negative the rotation will be counter-clockwise
  • flip: If the image should be filp (can be omitted, the default is false)

@derneuere
Copy link
Member

Looks good, but I think we should just stick to one new field. orientation and localOrientation seem to be the same, so we should just stick with orientation and only save it when the setting says so.

@tognee
Copy link
Author

tognee commented Jun 19, 2023

I think I can do that but I would need to disable the rotation made by the image library and apply the rotation myself. That way there will be less chances of de-sync of the variables.

Also when the user setting to save tags on the files is changed should all photos be updated or the idea is to have them save the tags only when modified after the settings change?

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

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