Test one edit before building a local image stack
Use the hosted image workflow for a first result or follow the official LongCat Image Edit path with measured memory and reproducible settings
LongCat-Image-Edit is Meituan's bilingual Chinese-English image editing model. Its official model card covers global edits, local edits, text modification, reference-guided editing, and preservation of non-edited regions such as layout, texture, color, and identity.
The upstream quick start uses a Diffusers pipeline. ComfyUI workflows, quantizations, and third-party custom nodes may be useful, but they are separate integrations. This guide does not label a community port as the official installation or promise that an unverified 8GB workflow will match the original model.
Choose an execution path
| Goal | Start with | Boundary |
|---|---|---|
| Validate one instruction | Hosted image-to-image | Provider availability and displayed credits apply |
| Reproduce the release | Official Hugging Face model card | Python/CUDA environment and model downloads |
| Use a ComfyUI graph | A source-linked community integration | Pin node, model, and workflow versions yourself |
| Edit private batches | Local official or audited deployment | You own storage, deletion, access, and output review |
Official Diffusers setup
python -m venv .venv
source .venv/bin/activate
pip install git+https://github.com/huggingface/diffusersThe model card's memory-saving example uses CPU offload and says it requires roughly 18GB. That is an official example-specific figure, not a universal minimum for every quantized or community implementation.
import torch
from PIL import Image
from diffusers import LongCatImageEditPipeline
pipe = LongCatImageEditPipeline.from_pretrained(
"meituan-longcat/LongCat-Image-Edit",
torch_dtype=torch.bfloat16,
)
pipe.enable_model_cpu_offload()
source_image = Image.open("input.png").convert("RGB")
edited_image = pipe(
source_image,
"Replace the blue mug with a red ceramic mug; keep everything else unchanged",
negative_prompt="",
guidance_scale=4.5,
num_inference_steps=50,
num_images_per_prompt=1,
generator=torch.Generator("cpu").manual_seed(43),
).images[0]
edited_image.save("edited.png")Run the official example unchanged before changing the prompt, image, dtype, offload, or step count. If it fails, surface the exact exception and environment versions; do not silently fall back to a different model.
Prompt one edit at a time
A repeatable edit instruction names:
- the target region or object;
- the requested change;
- the properties that must stay unchanged;
- any exact text, color, count, or position constraint.
Good example:
Replace the blue mug on the left with one matte red ceramic mug. Keep the person, hands, table, lighting, camera angle, and background unchanged.
Weak example:
Make this image better and more professional.
The first prompt has an observable pass/fail contract. The second invites a global restyle and makes consistency impossible to grade.
Text editing needs quotation marks
The official model card says target text must be wrapped in English or Chinese quotation marks so the character-level encoding path is triggered. For example:
Change the sign text to “OPEN 24 HOURS”; keep its font weight, perspective, material, and surrounding wall unchanged.
After generation, zoom in and transcribe the result character by character. A visually convincing sign can still contain missing, repeated, or substituted letters.
Local and reference-guided edit checklist
- Use the original-resolution source when possible; avoid repeated JPEG saves.
- Describe one target and one change per pass.
- Explicitly list high-value invariants such as identity, logo, product shape, and camera angle.
- Keep seed and settings fixed while comparing prompt changes.
- Save every intermediate result rather than repeatedly editing the latest lossy output.
- For reference-guided edits, confirm that you have rights to both the source and reference images.
VRAM and performance without fake guarantees
Memory use depends on dtype, offload, dimensions, steps, library commit, and whether other models remain resident. CPU offload lowers GPU pressure by moving work across devices, so it may increase system RAM use and runtime. Quantized community variants may trade fidelity or compatibility for lower memory.
Use a bounded measurement loop:
- Run one official example and record peak VRAM/RAM and time.
- Run your source at a smaller working size.
- Increase only the dimension needed for delivery.
- If using a third-party quantization, compare it against the same seed and prompt.
- Reject a variant if it changes protected regions or text accuracy beyond your quality bar.
Failure triage
| Symptom | Likely cause | First bounded action |
|---|---|---|
| Out of memory | Dimensions or model residency | Confirm CPU offload, reduce image size, rerun once |
| Unedited regions change | Prompt is broad or instruction is overloaded | Name the protected regions and split the edit |
| Text is misspelled | Target text was not quoted or too small | Quote exact text and use a clearer/larger source region |
| Identity drifts | Too much global change | Use a local instruction and lock face, hair, pose, and framing |
| Colors shift everywhere | Style language affected the full image | Specify the target object's color and preserve global lighting |
| New install breaks | Moving Diffusers/community dependencies | Restore recorded versions and retest the official sample |
Output acceptance gate
Compare source and output side by side, then overlay them if the edit is supposed to be local. Check target completion, protected regions, text spelling, object count, edges, reflections, shadows, anatomy, resolution, file format, and color profile. A result is not complete merely because it looks good at thumbnail size.
For commercial work, review the model license plus the rights for prompts, source images, reference images, logos, people, and downstream dependencies. Keep the source, accepted output, prompt, seed, model ID, library commit, and settings together so the job can be reproduced or rolled back.
Primary sources
- LongCat-Image-Edit official model card
- LongCat-Image official model card
- Hugging Face Diffusers repository
Use the hosted image editor for a first result. Choose local deployment only after the measured volume, privacy requirement, and maintenance cost justify it.