nextcloud-libraries / nextcloud-libraries/nextcloud-image-editor

Quarter turns and mirrors could avoid re-encoding entirely

Open
#19 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

AI assisted type: enhancement
Dominant language
TypeScript
Stars
2
Forks
0
Avg merge
1h 46m
Merged PRs (30d)
58

Description

A 90° rotation or a flip does not change a single pixel value, it only changes where they sit. We still send the whole image through renderToCanvas and re-encode it, so a JPEG loses quality every time someone straightens a photo, and a large one takes the full encode cost for a change a tag could express.

Asked for in nextcloud/viewer#2804, pointing at Memories which already does it.

The idea: when the only thing the state carries is some multiple of a quarter turn and/or a mirror, and the source is a JPEG, rewrite the EXIF orientation tag on the original bytes and hand those back untouched.

  • Recognise the case, no crop, no adjustment, no filter, no annotation, and rotation a multiple of 90
  • Map our rotation and flip state onto the eight EXIF orientation values
  • Return the original bytes with the tag rewritten
  • Fall back to the normal path for everything else, including PNG and WebP where there is no tag to lean on

Depends on #18, it needs the same reader and writer. Worth doing after it rather than inventing a second half-parser.

👾 Found while going through the viewer's editor issues with Claude Code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the existing renderToCanvas path and read the shared reader and writer from #18. The work is done when eligible JPEG quarter-turn and mirror states return the original bytes with the correct EXIF orientation, while other edits and PNG or WebP continue through the normal path.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.