Skip to main content
ModelsIntermediate4 min read

Qwen-Image 2.1: Generate and Edit Images Locally

i
iaLocale Team
•
Qwen-Image 2.1: Generate and Edit Images Locally

Qwen has released Qwen-Image 2.1, a 7-billion-parameter open-weight model for image generation and editing. It is the "compact" version of the Qwen-Image family: a single model that unifies text-to-image generation, editing, and transparent (RGBA) image creation, designed to run on local hardware.

Why it matters: for the first time, a model of this quality for image editing is open and runs locally, with no cloud API. If you have a GPU with at least 16GB of VRAM, you can start producing today.

What it does

Qwen-Image 2.1 unifies three things in a single model:

  • Text-to-image — creates images from a prompt, up to 2048x2048.
  • Editing — modifies an existing image: change the background, extract a subject, apply localized edits with circles or masks.
  • Native transparency — generates and edits RGBA images with an alpha channel, useful for stickers, icons, and overlay elements.

You can pass up to 10 reference images to preserve the identity of people or products. The generation component is a DiT (Diffusion Transformer) with 32 layers and 7B parameters: a choice that balances quality and computational cost.

How to run it locally

The most immediate way is diffusers, the library that runs the pipelines of generative models:

pip install torch>=2.4.0 transformers>=5.17 accelerate pillow
pip install git+https://github.com/huggingface/diffusers
import torch
from diffusers import QwenImage21Pipeline

pipe = QwenImage21Pipeline.from_pretrained(
    "Qwen/Qwen-Image-2.1", torch_dtype=torch.bfloat16
).to("cuda")

image = pipe(
    prompt="A neon sign that reads 'QWEN 2.1', night, reflections on wet pavement",
    width=2048, height=2048, num_inference_steps=40,
).images[0]
image.save("out.png")

On a GPU with less memory, pipe.enable_model_cpu_offload() moves layers between CPU and VRAM on the fly, at the cost of speed:

pipe = QwenImage21Pipeline.from_pretrained("Qwen/Qwen-Image-2.1", torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload()

Alternative: ComfyUI

If you prefer a node-based interface, ComfyUI has added native support for Qwen-Image 2.1: 2K generation and editing with visual workflows, useful for anyone automating image production.

Editing: a practical example

The real strength over a generate-only model is editing. The pipeline accepts input images in addition to the prompt, and you can limit the change to a region with a mask (a black-and-white image: white where to change, black where to keep):

# localised edit: only the masked area changes
from PIL import Image

image, mask = Image.open("product.png"), Image.open("mask.png")
out = pipe(
    prompt="Turn the background into a wooden table in a kitchen",
    image=image, mask=mask,
    width=1024, height=1024, num_inference_steps=30,
).images[0]
out.save("product-edited.png")

The same model does editing and generation, so a ComfyUI workflow can alternate the two phases without switching checkpoints: generate the product in a studio, then re-stage it in a different scene while keeping identity and details.

How much GPU is needed

The model in bfloat16 occupies about 14GB of VRAM. In practice:

  • 16GB (RTX 4060 Ti 16GB, RTX 5080) — runs, with offload if the scene is 2K.
  • 24GB (RTX 4090, 3090) — comfortable, no offload.
  • Less than 16GB — use CPU offload or reduce the output size (e.g. 1024x1024).

When it makes sense

Qwen-Image 2.1 shines when the image is a product, not an afterthought:

  • Assets and stickers — native transparency removes the "remove background" step that previously needed a separate tool.
  • Product photos — the 10 reference images keep a product consistent across multiple scenes.
  • Local design workflows — with ComfyUI you build a repeatable chain, never sending images to a cloud service.

In short

It's a concrete step for anyone who wants local image production: a single, open model that generates, edits, and creates transparency. With 7B parameters and ComfyUI support, it is one of the most accessible in its category today.

Article generated with AI

#comfyui#diffusion#generazione#immagini#qwen
Share:

Enjoyed this article?

Subscribe to the newsletter for new tutorials and guides.

After signing up you receive a confirmation email (double opt-in). Without confirmation we send nothing. No spam, we promise.

Related Articles