AI Image Text Translation: Localizing Ecommerce Images Without Altering the Artwork
This article explains how AI image text translation localizes ecommerce visuals while keeping layout and look intact. It walks through OCR, domain-aware translation, background inpainting, and text re-rendering, plus batch consistency and practical pipeline checks.
Why translating text in images is a real engineering problem
In cross-border ecommerce, a listing typically rests on three pillars: title, description, and images. Titles and copy are plain text and can be handled quickly with a machine translation API. Text on images—hero callouts, scene annotations, A+ graphics, and instruction screenshots—is burned into pixels and cannot be swapped like a string in HTML.
The traditional workflow is manual: a designer erases the original copy in Photoshop, types the translation, and retunes font and color. Dozens of images per SKU means high cost, long lead times, and uneven style. AI image translation aims to take a photo that contains foreign-language text and return a new image whose layout is unchanged, whose wording is translated, and whose look is restored. That sounds simple, but it chains several computer vision and image-generation problems.
The goal is not overlay captions. It is to change the words without destroying the picture: restore the background where old glyphs sat, and blend new type into the original visual system.
End-to-end pipeline: four stages
Turning a Chinese ecommerce image into a natural English one usually follows this flow:
Input image → ① text detection and recognition → ② semantic understanding and translation→ ③ background restoration (inpainting) → ④ text re-rendering → output image
1. Text detection and recognition (OCR)
The first job is to find the words and read them.
- Detection locates a bounding box for each line or block. Ecommerce type is messy—horizontal, vertical, curved, stylized, overlapping the product—so the detector needs strong generalization. Lightweight segmentation-based detectors are the common choice; they handle tilted and curved text better than classic regression boxes.
- Recognition turns each crop into a character sequence. It also supplies two signals that later stages depend on: precise position and orientation of each character, and estimates of color and size.
# Pseudocode: typical OCR outputresults = ocrDetectRecog(image)# results[i] = {# "text": "Save 50% instantly",# "box": [(x1,y1),(x2,y2),(x3,y3),(x4,y4)], # four-point box, supports tilt# "direction": "horizontal",# "color": {"fill": "#FFFFFF", "stroke": "#FF0000"}# }
2. Semantic translation: not word-for-word
Raw OCR text should not be dumped into a generic translator. Marketing lines such as “hot seller,” “flash sale,” or “buy one get three” sound stiff in English and can even violate marketplace rules if translated literally. Production systems typically:
- Adapt to the domain: treat the span as marketing copy and use an ecommerce-tuned model or glossary post-processing;
- Control length: Chinese is dense; English often expands 30%–80%. Unchecked expansion blows the original box. Common tactics are shortest-of-N translation candidates, or shrinking type / wrapping at render time.
3. Background restoration: making old text disappear
This is the first requirement of the “we did not rewrite the photo” look. Covering type with a white rectangle is smear-and-hope; gradients, textures, product edges, and studio lighting give it away immediately.
Inpainting options:
- Classical: diffusion from neighboring pixels works on solid fills and simple gradients, but blurs texture and structure (for example type sitting on a product edge);
- Deep generative: a model learns plausible content for the occluded region, filling texture and continuing structure and lighting. Diffusion-based inpainters have made “you cannot tell it was patched” realistic.
An easy-to-miss detail is mask accuracy. A mask slightly larger than the glyphs eats extra background; slightly smaller leaves stroke edges. In practice, OCR boxes are expanded a few pixels along stroke direction and the mask is feathered so the fill meets unedited pixels smoothly.
4. Text re-rendering: the step that sells “premium”
Background is restored and copy is ready; the last step is to paint the new words back. This decides whether the result looks pixel-native or pasted on.
The renderer must infer several properties from the original:
| Property | What it means |
|---|---|
| Layout direction | Horizontal, vertical, or curved along the product |
| Type style | Bold sans, calligraphy, beveled 3D type, and so on |
| Lighting | Shadows, highlights, and inner shadows should match |
| Material blend | Etched metal, glass glare, fabric print |
| Alignment | Left or center, and spacing relative to nearby elements |
Example: original type sits on a black brushed-metal panel with a faint specular highlight. Stamping white letters looks cheap. Matching the same highlight and letterform reads as factory-original.
Early systems used geometry plus style transfer: warp a standard glyph to the original pose, then restyle color and texture. Newer work leans on conditional generation: take the inpainted background as canvas and the translated string as a condition, and generate the full image with type in place (scene text rendering / text embedding). Fusion of type and scene is then learned end to end.
Why batch jobs can still stay consistent
A single SKU can be hand-tuned; hundreds of store images cannot. AI batches stay consistent because the pipeline is structured:
- Global type decisions: pick one brand-aligned family for the set, then scale by each image’s original size ratio—not a new font per frame.
- Global terminology: the same selling point keeps the same translation everywhere (no “Free Shipping” morphing into another phrase on the next shot).
- Unified color policy: mapping can be set once—for example keep original fill unless contrast is too low, then boost it.
That pipeline-level uniformity is hard to keep when people edit frame by frame.
Engineering notes for building or evaluating a pipeline
If you are standing up or scoring an image-translation stack, these points matter:
- Dense layouts first: A+ pages and manuals pack type with little whitespace; they stress length control and wrapping and make a good tuning baseline.
- Neon and display type are hard: high-end art fonts (stroke + gradient + glow) still fail often; route them to human review.
- Map source vs. target character counts: estimate expansion; when it overflows, choose among shrink type, grow the box, or shorten copy—do not shrink until the words are unreadable.
- QA metrics for CI: OCR error rate, leftover-mask rate, font-consistency rate, and hits on restricted terms.
- Storage and dataflow: batch images through object storage and a message queue; persist translations plus metadata (original boxes, fonts used) for reuse and audit.
Takeaway
AI image translation can change the words without changing the picture because it splits a designer’s craft into four automatable, globally consistent stages: detect and recognize → translate with semantics → inpaint the background → conditionally re-render type. Inpainting hides the old glyphs; conditional rendering fuses the new ones with the scene. Together they produce a “visually native” result. For engineering teams, knowing each stage’s limits and failure modes matters more than chasing any single tool—and that knowledge sets the ceiling on output quality.
