跳到正文
DEV Community· islam al-nashera·· 3 小時前AI 評分32

Glitch-Img-1.0:以 Qwen-Image-2.1 生成及編輯 RGBA 圖像

Glitch-Img-1.0: RGBA Image Generation & Editing with Qwen-Image-2.1

AI 導讀

Glitch-Img-1.0 是 Qwen-Image-2.1 的重新上傳版本,支援文字生成圖像、圖像編輯及原生 RGBA 透明度生成,模型權重和設定檔均未更改。模型視覺生成部分約有 7B 參數,最多可使用 10 張參考圖,並支援局部編輯。它採用非商業用途的 Qwen Research License;商業用途須另行申請授權。

正文

islam al-nashera

Glitch-Img-1.0: RGBA Image Generation & Editing with Qwen-Image-2.1

Try it: huggingface.co/ISLAM-PO/Glitch-Img-1.0 · image-gen demo Space

Image generation has moved past "pretty pictures" toward controllable, editable, transparent assets. Glitch-Img-1.0 is my re-upload of Qwen/Qwen-Image-2.1 under the name ISLAM-PO/Glitch-Img-1.0, aimed at making a strong unified text-to-image + editing model easy to discover and use from a single, well-documented repository. All weights and configs are unchanged from the original; only the README and repo IDs were updated, and the model is Built with Qwen under the Qwen Research License (non-commercial).

This report covers what the model does, its key capabilities, a quick-start, memory tips, and licensing notes.


1. What It Is

  • Base model: Qwen/Qwen-Image-2.1
  • Visual generation component: ~7B parameters (32 Single-Stream DiT layers)
  • Pipeline tag: text-to-image (diffusers: QwenImage21Pipeline)
  • License: Qwen Research License Agreement (non-commercial)
  • Modifications in this re-upload: README renaming, repo-ID updates, attribution notes. Weights/configs unchanged.

Four headline improvements define the Qwen-Image-2.1 family this build inherits:

  1. Compact & efficient — mixed-granularity attention + prefix KV-cache reuse for strong quality at low cost.
  2. Native transparency (RGBA) — generate regular or transparent images, edit transparent layers, extract subjects from photos — all in one model.
  3. Versatile editing — up to 10 reference images, local edits via circles/painted annotations/masks, identity preservation for people and products.
  4. Realistic textures & refined aesthetics — improved typography, portrait lighting, and fine details.

2. Capabilities in Practice

Capability Details
Text-to-image Prompts up to 2048×2048 and beyond; strong text rendering
Image editing Inpainting-style edits, background swaps, style transfer
RGBA transparency Native alpha channel generation with a documented prompt format
Multi-reference Up to 10 reference images for identity/subject consistency
Local edits Circles, painted annotations, separate masks
Aspect ratios 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16 presets

3. Quick Start

Install:

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

Text-to-image:

import torch
from diffusers import QwenImage21Pipeline

pipe = QwenImage21Pipeline.from_pretrained(
    "ISLAM-PO/Glitch-Img-1.0", torch_dtype=torch.bfloat16
).to("cuda")

image = pipe(
    prompt='A neon shop sign that reads "GLITCH IMG 1.0", rainy night, reflections on wet pavement',
    width=2048, height=2048,
    num_inference_steps=40,
    generator=torch.Generator("cuda").manual_seed(42),
).images[0]

image.save("t2i_example.png")

Image editing:

import torch
from PIL import Image
from diffusers import QwenImage21Pipeline

pipe = QwenImage21Pipeline.from_pretrained(
    "ISLAM-PO/Glitch-Img-1.0", torch_dtype=torch.bfloat16
).to("cuda")

input_image = Image.open("input.png")
image = pipe(
    prompt="Change the background to a sunset beach",
    image=input_image,
    num_inference_steps=40,
    generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("edit_example.png")

Transparent (RGBA) generation — use the recommended prompt format:

image = pipe(
    prompt="This is an RGBA image with transparency. A cute cartoon dragon sticker. "
           "The image has alpha channel and the background is transparent.",
    width=2048, height=2048,
    num_inference_steps=40,
    generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("transparent_example.png")

Aspect ratios:

aspect_ratios = {
    "1:1":  (2048, 2048), "4:3":  (2400, 1792), "3:4":  (1792, 2400),
    "3:2":  (2528, 1696), "2:3":  (1696, 2528), "16:9": (2752, 1536),
    "9:16": (1536, 2752),
}

4. Memory Optimization

pipe = QwenImage21Pipeline.from_pretrained(
    "ISLAM-PO/Glitch-Img-1.0", torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()

This offloads model parts to CPU between steps, letting you run on smaller GPUs at the cost of speed.

5. Where It Fits in My Stack

I use Glitch-Img as the visual layer behind my portfolio and product work:

  • Generating marketing assets and transparent stickers/logos for client sites.
  • Editing product photos (background swap, identity-preserving edits).
  • Producing RGBA assets that drop straight into web UIs without manual masking.

It complements MasryGPT (text) as the two halves of an Arabic-first AI product stack: one generates the words, the other the visuals.

6. Licensing & Attribution

  • Licensed under the Qwen Research License Agreement — non-commercial use only.
  • Original work © 2026 Hangzhou Tongyi Laboratory Technology Co., Ltd.
  • This re-upload is Built with Qwen and based on Qwen/Qwen-Image-2.1.
  • For commercial use, request a license at model-business@notice.qwencloud.com.
  • See NOTICE and LICENSE in the repo for required attribution.

7. Links


Author: Islam Al-Nashar — Full-Stack Developer & AI builder. GitHub · Hugging Face · Portfolio

來源:DEV Community · dev.to