Skip to content

feat(image-padding): calibration by default, phone-frame fix, one-screen redesign - #24

Merged
Rushabhshroff merged 2 commits into
BrowserStackCE:mainfrom
harshitshah4:padfit-phone-frame-and-calibration
Dec 3, 2026
Merged

Rushabhshroff merged 2 commits into
BrowserStackCE:mainfrom
harshitshah4:padfit-phone-frame-and-calibration

Conversation

@harshitshah4

@harshitshah4 harshitshah4 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Image Padding Tool (was PadFit, docs/tools/image-padding/index.html): calibration is now the default flow, the App Live phone frame no longer breaks viewfinder detection, and the page is redesigned as one screen.

Why. Some apps show a different part of the camera image in the viewfinder than the box position on screen suggests. In the SITA Kenya eTA app, the scan box sits at about 17–46% of the screen height but shows rows 32–66% of the injected image. So the tool put the passport in the wrong place and the scan failed. Screenshots from the App Live dashboard can also include the dark phone frame, which made the tool pick the whole screen as the viewfinder.

What changes

  1. Phone frame. The tool finds the thin dark ring around the screen and crops to the screen first.
  2. Calibration by default, two inputs. The user downloads one calibration image (1080x1920, colour gradient with a line every 10%), injects it, takes a screenshot of the camera screen, and uploads that screenshot plus the image to inject. The tool reads which part of the grid the viewfinder shows and places the subject there. The output is 1080x1920. If the screenshot has no grid (a normal screenshot), the tool falls back to the viewfinder on screen, as before.
  3. One-screen layout. A 5-step guide on the left (download, inject and take a screenshot, upload screenshot, upload image, check and save). Three panels: the app screenshot (also shows a preview of what the app sees), the image to inject, and the output. The panels are upload targets. The user drags and scrolls on the output to move and resize the image. Step 2 names Capture Screenshot (App Live) and takeScreenshot (App Automate, with a docs link).

Testing

  • 8 existing screenshot/image regression pairs: output unchanged.
  • 97 test screenshots: the phone-frame crop fired only on the 2 that have a real phone frame. 0 of 92 non-grid screenshots were read as calibrated.
  • Simulated 1080x1920 grid in 5 camera frame shapes and 2 viewfinder bands: read back within 0.5%.
  • App Live, Pixel 11 Pro, Android 17, SITA Kenya eTA: a calibration screenshot read 32.6–67.4% (Regula's own log: 32.3–67.7%). The calibrated image scanned and the app opened "Confirm details". The uncalibrated image did not scan. The same screenshot in the new page gives a 1080x1920 output with the passport at 32.4–67.5% of the height.
  • Chrome: engine loads, "Try an example" runs end to end, light and dark theme.

Limits

  • The SITA device test used an earlier 1080x2410 grid. A device re-test with the 1080x1920 grid is still to do.
  • Not tested on iOS yet.
  • Calibration needs the injected image to show in the viewfinder on screen. It does not handle a rotated image, and a mirrored image (front camera) is not tested.

🤖 Generated with Claude Code

Screenshots from the App Live dashboard can include the dark phone frame, and PadFit then picked the whole screen as the viewfinder. PadFit now crops to the screen inside the frame first.

Some apps show a different part of the camera image in the viewfinder than the box position on screen suggests (SITA Kenya eTA: box at about 17-46% of the screen, shows 32-66% of the image). Optional calibration: inject a colour grid, screenshot the camera screen, and PadFit reads which part of the image the viewfinder shows, then places the subject there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Rename PadFit to Image Padding Tool and make calibration the default
flow. The tool now takes two inputs: the app screenshot and the image
to inject. If the screenshot shows the injected calibration grid, the
tool reads it and places the subject where the app reads the camera
image. If it does not, the tool falls back to the viewfinder on screen.

The calibration grid is now a fixed 1080x1920 image, so one download
works for every app, and a calibrated output has that size.

Layout: a single page with no scrolling. A step-by-step guide sits on
the left. The screenshot, image and output panels are upload targets.
The output panel is where the user checks the result and moves or
resizes the image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@harshitshah4 harshitshah4 changed the title fix(padfit): crop App Live phone frame and add viewfinder calibration feat(image-padding): calibration by default, phone-frame fix, one-screen redesign Dec 3, 2026
@harshitshah4
harshitshah4 marked this pull request as ready for review December 3, 2026 14:15
@Rushabhshroff
Rushabhshroff merged commit 1c95df1 into BrowserStackCE:main Dec 3, 2026
1 of 2 checks passed
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.

3 participants