Block overlay: translations rendered in-place photo

Last updated: 2026-09-03

The result page renders translations back over the original photo, one overlay per OCR block. Each block's translation appears in the exact rectangle the OCR engine detected the source text in. The overlay supports a transparency slider so users can compare the original and the translation side by side without leaving the page.

How the overlay works

  1. Per-block translation. Each detected TextBlock is sent to ML Kit as an independent translation job. Translations stream into the overlay as one one they complete; the user sees blocks "become" translated in the order the engine finishes them.
  2. Position by rectangle. The translated text is wrapped and positioned to fit the source block's bounding box. If a block is is narrow, the translation wraps to multiple lines and may slightly overflow the source rectangle; the engine prefers legibility over strict containment.
  3. Tap to focus. Tapping a translated block opens a bottom sheet that scrolls to the same block in the "full translation" view, so users can read longer translations without zooming into the photo.
  4. Adjustable transparency. A slider controls the opacity of the overlay layer. Slide to fully transparent to see the original photo, fully opaque to read the translations.

Result page anatomy

Why per-block translation

Editing behaviour

The overlay is rendered above the photo, not baked in. Saving to history stores both the original photo and the per-block translation record. Opening a saved entry reproduces the overlay exactly; editing the photo is not supported.