Skip to content

T413556-Add rotate option to OCR tool#148

Open
Agamya-Samuel wants to merge 5 commits into
wikimedia:mainfrom
Agamya-Samuel:T413556-add-rotate-option
Open

T413556-Add rotate option to OCR tool#148
Agamya-Samuel wants to merge 5 commits into
wikimedia:mainfrom
Agamya-Samuel:T413556-add-rotate-option

Conversation

@Agamya-Samuel
Copy link
Copy Markdown

Add rotate option to OCR tool

  • Apply image rotation server-side (Imagine) before cropping and OCR,
    • thread the rotate parameter through the controller and engine layers, and add simple UI controls (output.html.twig, assets/app.js) to rotate via Cropper.js.
  • Also include rotate in the cache key so rotated results are cached separately.

Fixes: T413556

I noticed there’s already a PR open (#147) addressing this issue. Since that patch includes some changes that might not be strictly necessary, and it hasn’t had recent updates, I went ahead and explored my own implementation in the meantime.

@Agamya-Samuel
Copy link
Copy Markdown
Author

Preview:

2026-01-29.15-24-25.mp4

@Parthiv-M
Copy link
Copy Markdown
Collaborator

Have not taken a proper look at the code but on first glance it seems like it'd be better to use either OOUI icons or Codex icons.

@samwilson
Copy link
Copy Markdown
Member

Since that patch includes some changes that might not be strictly necessary, and it hasn’t had recent updates, I went ahead and explored my own implementation in the meantime.

That other patch was last updated only a couple of weeks ago, so I'd recommend first asking @shraddhaa09 if they're still working on it, and reviewing their patch to discuss how it can be improved. Always better to help a work-in-progress rather than jumping in with a new patch for someone else's task (although as the task isn't assigned to Shraddha it's technically available, but that's probably just because they aren't familiar with how things are done, I'm guessing).

@Agamya-Samuel
Copy link
Copy Markdown
Author

Have not taken a proper look at the code but on first glance it seems like it'd be better to use either OOUI icons or Codex icons.

Sure.


<div class="btn-group" role="group">
<button type="button" class="btn btn-default rotate-left" title="Rotate left">
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used Unicode Character for Rotate Left,

</button>
<button type="button" class="btn btn-default rotate-right" title="Rotate right">
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used Unicode Character for Rotate Right,

@Agamya-Samuel
Copy link
Copy Markdown
Author

Agamya-Samuel commented Jan 30, 2026

@Parthiv-M thanks for pointing this out.

Currently I implemented the use of - Unicode Characters ( and ) to denote Rotate Left and Rotate Right

I gone thru the Codex icons library. Codex currently doesn’t provide a dedicated “rotate” icon.

I also wen thru the OOUI icons library.

There is an Icon for Reload which can be repurposed, as visually they are the same,

image

The other closest available options in OOUI are the curved arrow icons (undo/redo),

image image

which can be used to represent rotate-left / rotate-right actions in image editing contexts (if that suits the current needs of T413556)

If we find this causes confusion or Codex adds rotation-specific icons later, we can revisit.

Or if there is better way we can handle this ?

@Agamya-Samuel
Copy link
Copy Markdown
Author

Agamya-Samuel commented Jan 30, 2026

Since that patch includes some changes that might not be strictly necessary, and it hasn’t had recent updates, I went ahead and explored my own implementation in the meantime.

That other patch was last updated only a couple of weeks ago, so I'd recommend first asking @shraddhaa09 if they're still working on it, and reviewing their patch to discuss how it can be improved. Always better to help a work-in-progress rather than jumping in with a new patch for someone else's task (although as the task isn't assigned to Shraddha it's technically available, but that's probably just because they aren't familiar with how things are done, I'm guessing).

Thanks @samwilson for the suggestion. I agree that building on existing work is generally the better path when someone is actively progressing on a patch.

That said, when I looked at the open patch, it included additional changes beyond what was needed for this specific issue, and there wasn’t any clear indication yet whether it was still being actively driven to completion (last commit was on 16 Jan).

Rather than letting the task stall, I explored a minimal, focused implementation in parallel to keep momentum and provide an alternative that can be evaluated.

I’m more than happy to coordinate with @shraddhaa09 and review their approach as well. If their patch is still in progress and closer to the intended direction, we can consolidate efforts or adjust accordingly. My goal here isn’t to duplicate work, but to ensure the rotation support lands cleanly and without unnecessary delay.

@shraddhaa09
Copy link
Copy Markdown

Hi ,
Just to clarify from my side: I am actively working on PR #147 and addressing the rotation logic, crop reset issue, and UI feedback that’s been raised. I’ll be pushing updates shortly.

Thanks for checking in.

@samwilson
Copy link
Copy Markdown
Member

@shraddhaa09 @Agamya-Samuel: Okay great, sounds good! So I think if you two can settle on one of these patches and then work together to review it, that'd be best.

@okerekechinweotito
Copy link
Copy Markdown
Contributor

@shraddhaa09 @Agamya-Samuel
Please checking to see if you are still working on this issue

@Agamya-Samuel
Copy link
Copy Markdown
Author

Agamya-Samuel commented Mar 1, 2026

@shraddhaa09 @Agamya-Samuel Please checking to see if you are still working on this issue

@okerekechinweotito I am still in the process of completing the patch

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants