TransAnyText: Translating Arbitrary Text in E-commerce Images via Structured Visual Generation
SourceFull paper
Article overview
Verdict
A strong, broadly reproducible approach to multilingual image-text translation: structured HTML, inpainting, and deterministic rendering achieve the best aggregate results among the listed baselines. Its generality is limited by HTML/CSS expressiveness for curved and highly stylized text.
Main idea
TransAnyText translates an image into a target language through VLM-generated, editable HTML patches containing text, position, font, color, and size. The background is restored separately, and the patches are then deterministically rendered onto it.
Mechanism
Representation: the VLM generates HTML/CSS patches containing translated text and placement/style attributes; a separate model restores the background, after which HTML is rendered deterministically. Operation order: (1) jointly train the VLM and conditional flow-matching inpainting model with SFT; (2) train an image-only student against a teacher additionally conditioned on source-language HTML; (3) weight token-level reverse-KL by the teacher–student log-probability gap so PWSD emphasizes tokens where the teacher has an advantage; (4) run GRPO over grouped rollouts with verifiable rewards for HTML validity, position, translation, and style; (5) constrain deviation from the PWSD checkpoint; (6) optionally apply diffusion refinement. Inpainting models a linear probability path from clean background to the original image and regresses the velocity field. Data and targets use TransAnyDataset, while evaluation covers translation, visual fidelity, and realism on TransAnyBench. Exact architectures, model sizes, optimization schedules, rollout hyperparameters, and compute costs are not specified in the records. Reproduction plan: prepare the 10-language image–translation data; train the VLM to produce valid HTML patches and the inpainting model; implement gap-weighted teacher–student PWSD; add GRPO with verifiable rewards and a KL constraint; compare SFT, PWSD, GRPO, and refinement on COMET, position, style, visual fidelity, and HTML renderability.
What this is useful for
The method is especially suitable for multilingual advertising and e-commerce images where editability, precise text placement, and background preservation matter. HTML representation is most useful when text is mainly straight and describable with standard CSS attributes.
Risks / not proven
HTML/CSS is less expressive for curved and highly stylized text; diffusion refinement only partially mitigates this weakness. Quality on unreported languages, domains, or baselines cannot be inferred because those results are absent from the records. Key architectural details and compute costs are also unspecified, limiting exact reproducibility.
Full abstract
Cross-border e-commerce image translation is essential for global retail, where product images, banners, and detail pages need to be produced in different languages. Existing methods struggle to achieve accurate translation, faithful visual identity preservation, and easy-to-edit outputs, simultaneously. To address these challenges, we introduce TransAnyText, a structured visual code framework that reformulates image text translation as generating renderable HTML patches from source images and target languages. Our framework decouples semantic generation from pixel rendering: a vision-language model (VLM) handles visual understanding, cross-lingual translation, and structured visual generation, while a diffusion model performs background inpainting and pixel-level refinement, followed by deterministic rendering to synthesize the final image. Based on this formulation, we develop a three-stage post-training framework, where supervised fine-tuning (SFT) establishes the image-to-code mapping, privilege-gap weighted self-distillation (PWSD) improves the learning of style and layout tokens, and reinforcement learning with verifiable rewards (RLVR) further optimizes task-level performance. We further introduce TransAnyDataset and TransAnyBench, a multilingual dataset and benchmark for e-commerce image translation. Extensive experiments demonstrate competitive performance against cascaded pipelines, open-source end-to-end models, and closed-source image editing systems, providing an effective, controllable, and editable solution for cross-border e-commerce image translation.