ComfyUI Node

图片翻译

Translate the text inside an image without re-rendering it

By MoJIeAIGC·Created about a year ago·Updated 17 days ago· 50
图片翻译
  • image_input
  • output
modeliddefault
SourceLang自动
TargetLang英语
seed0

Here's the workflow that normally eats an afternoon: you have a product image with Chinese text baked into the design - a label, a banner, a sign - and you need an English version for the other marketplace. You can't just translate the text, because it's in the image. The classic local answer is to mask the text, inpaint it out, then render new text on top, hoping the font matches. This node replaces that whole dance with one call: it reads the text in the image and redraws it in another language, in place, keeping the design. That's the pitch, and it's a genuinely common e-commerce need.

How it works

Your image is base64'd and POSTed to the gateway under the model id image_translate, with source and target languages. The backend does OCR, translates, and re-renders the text into the image - meaning the output is a new image, not a text string. The node actually loops over your whole input batch, one API call per image, so you can drop several images in and get them all translated in one queue. One extra knob: modelid with default vs erase. erase is the mode that removes the original text before redrawing - useful when you want the translated text cleanly placed rather than overwritten.

The inputs that matter

  • image_input (IMAGE) - batch-capable. Each image becomes its own translation call.
  • SourceLang (33 options, default 自动/auto) - let it auto-detect for most cases; pick explicitly if auto guesses wrong.
  • TargetLang (16 options, default 英语/English) - where it's going. Chinese, Japanese, Korean, French, German, Spanish and more are on the list.
  • modelid (default / erase) - the erase behavior above.
  • seed (INT) - reproducibility.

One output, output (IMAGE).

Installing it

Part of comfyui-MJAPI-party. ComfyUI Manager → "mojieapi_party" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/MoJIeAIGC/comfyui-MJAPI-party.git

Register at mojieaigc.com, put your key in config.ini (leave BASE_URL = https://www.mojieaigc.com/v1/completions as shipped), restart:

[API]
KEY = your_api_key
BASE_URL = https://www.mojieaigc.com/v1/completions

No downloads; standard pack dependencies.

Common issues

  • The translated text breaks the layout. Re-rendering text in place is hard - longer target languages can overflow their boxes. Expect to retouch, or pick shorter translations. This is a massive time-saver, not a pixel-perfect typesetting tool.
  • Small or stylized text gets mangled. OCR works best on clean, reasonably-sized text. Tiny watermark-style glyphs or heavily stylized fonts are where it stumbles - upscale the image first if you can.
  • erase mode left a hole where text was. If removing the original text created a visible patch, the source text sat on a complex background. A default pass that overwrites may look better than a true erase.
  • Error image with text - the pack's standard failure display (key, balance, timeout).
Category🎨MJapiparty/Tools_api

Inputs (5)

NameTypeDefaultDescription
image_inputIMAGE
modelidCOMBOdefault2 options: default, erase
SourceLangCOMBO自动33 options: 自动, 阿拉伯语, 法语, 英语, 加泰罗尼亚语, 葡萄牙语, +27
TargetLangCOMBO英语16 options: 英语, 中文, 中文 (繁体), 日语, 韩语, 阿拉伯语, +10
seedINT0

Outputs (1)

NameTypeDescription
outputIMAGE