ComfyUI:使用Z-Image生成高质量人像
Z-Image 是什么?
Z-Image 是阿里通义团队开源的高效图像生成基础模型,虽然只有6B参数,但是在2025年底却火遍互联网,原因就是配置要求极低,生成的图像效果极好。下面来实验一下。
通过ComfyUI部署z-image
ComfyUI的模板里已经内置了z-image,所以通过ComfyUI使用z-image非常简单。
环境要求
- Python 3.8+
- NVIDIA 显卡,6GB+ 显存(推荐 8GB+)
- 约 15GB 磁盘空间存放模型
部署ComfyUI
# 1. 基本环境
git clone https://github.com/comfyanonymous/ComfyUI.git
# 2. 可选:使用conda管理python版本和依赖环境
conda create -n py313 python=3.13
conda activate py313
# 3. 如果有Nvidia GPU:
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130
pip install -r requirements.txt
# 4. 启动
# 如果只有CPU,那么 python main.py --listen 0.0.0.0 --cpu
python main.py --listen 0.0.0.0
启动后,打开浏览器访问 http://127.0.0.1:8188 即可使用z-image。
模型下载
首次打开z-image,需要下载三个核心文件(国内可将 huggingface.co 替换为 hf-mirror.com),界面上会有对应地址的提示,也可以直接使用以下命令完成:
cd models
# vae
wget https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors -O vae/ae.safetensors
# text encoder
wget https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/text_encoders/qwen_3_4b.safetensors -O text_encoders/qwen_3_4b.safetensors
# diffusion model
wget https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/diffusion_models/z_image_turbo_bf16.safetensors -O diffusion_models/z_image_turbo_bf16.safetensors
# loras model
wget https://huggingface.co/tarn59/pixel_art_style_lora_z_image_turbo/resolve/main/pixel_art_style_z_image_turbo.safetensors -O loras/pixel_art_style_z_image_turbo.safetensors
国内用户可以将 huggingface.co 替换为国内镜像源 hf-mirror.com。
将下载后的模型路径如下:
ComfyUI/
├── models/
│ ├── text_encoders/
│ │ └── qwen_3_4b.safetensors
│ ├── diffusion_models/
│ │ └── z_image_turbo_bf16.safetensors
│ └── vae/
│ └── ae.safetensors
使用z-image
打开浏览器访问 http://127.0.0.1:8188 (具体端口请参考ComfyUI的配置),点击“模版”,点击“Z-Image-Turbo文生图”,即可看到z-image工作流,可以先忽略其他节点,在“CLIP文本编码”节点中输入提示词,点击“运行”即可直接出图。
这是一组极简又充满清新感的写真。以纯净的白色为背景,让视觉焦点完全集中在人物身上。一位年轻女性穿着简约的白色吊带,侧身面向镜头,突出干净、素雅的气质;发型是黑色微卷长发,搭配两朵蓝紫色系的仿真花作为发饰,色彩清新又吸睛,为整体造型增添了自然灵动感。画面氛围柔和,仿佛能感受到静谧温柔的气息,很适合展现简约却又不失精致的美感,仿佛将春日里花朵的清新与少女的恬静融合在了一起。
Magazine cover layout with visible text:
Large title "Z-Image" at the top.
Small cover text: "代码冲动", “AI学习笔记”, “Vol. 01 | January 2026”.
Barcode at the bottom corner.
首次使用需要加载模型,时间会比较长,后续再出图就很快了。 实测出图速度:
- AMD Ryzen9无显卡纯CPU,约600-700秒出图;
- 2080ti魔改22G显存显卡,约120-240秒出图;
- 4090显卡,约70-80秒出图;
据说在H800 GPU上可实现亚秒级出图。
一些常用的提示词
| 类别 | 常用关键词 |
|---|---|
| 整体品质提升 | 杰作、最佳质量、超详细、高度细节、8k、4k、照片级真实、超写实、逼真 |
| 人物年龄与成熟度 | 年轻女性、二十岁出头的女性、成熟面容、成年女性(避免:女孩、少女) |
| 面部细节 | 无瑕肌肤、白皙皮肤、细致皮肤纹理、毛孔细节、明亮眼睛、细致眼睛、光泽嘴唇、淡妆 |
| 表情与神态 | 浅笑、沉思表情、忧郁眼神、若有所思、微嘟嘴、自然表情 |
| 头发 | 长直发、丝滑秀发、发丝细节、自然飘动的头发、柔软刘海、轻薄刘海 |
| 光线与氛围 | 电影感光线、柔和自然光、戏剧性低调光线、轮廓光、柔和逆光、黄金时刻、氛围感 |
| 构图与视角 | 特写肖像、侧面、四分之三侧脸、上半身、浅景深、背景虚化 |
| 背景控制 | 纯黑背景、深黑背景、模糊户外背景、清澈蓝天、柔和散景 |
| 相机与渲染风格 | 佳能EOS拍摄、50mm镜头、f/1.8光圈、原片、轻微胶片颗粒、锐利对焦 |
| 负面提示 | 低分辨率、解剖错误、手部错误、模糊、失焦、变形、丑陋、儿童、幼态、多余手指、水印、文字 |
| 权重加强示例 | (masterpiece:1.3)、(photorealistic:1.2)、(detailed eyes:1.1) |
人物肖像
下面找一张明星肖像照片,尝试使用z-image生成类似的图片。
这是一幅超现实主义的电影肖像,一个年轻的亚洲女人,有着黑色的长发,精致的面部特征,白皙的皮肤,穿着宽松的白色长袖衬衫,在一条狭窄的故宫红墙小巷里,背靠着红色漆墙旁边的深色墙壁,弯曲的瓦片屋顶汇聚在一起,带着沉思的表情仰望着阴暗的灰色天空,怀里抱着一本书,柔和的漫射自然光创造出微妙的阴影。低视角向上仰视,朦胧的气氛,逼真的织物纹理和建筑细节,高分辨率8K,浅景深聚焦主体。
试试那种逆光浑身光芒的效果
从侧面看,这是一位20岁出头的东亚年轻女性的宁静肖像,棕色的长发扎在一个低马尾辫上,饰有一朵白色的大鸡蛋花。她穿着一件柔软的白色针织衫裙,优雅地站在一个古老的中国寺庙庭院里,在日出的黄金时刻,温暖的阳光在她的头发上逆光照射,营造出柔和的光环效果。她的表情是沉思的,一只手轻轻地抚摸着她的胸部,柔和的散景背景,模糊的传统瓦片屋顶和绿色植物,电影般的灯光,高细节,逼真,8k分辨率,杰作。
面部特写
A close-up of a teenage girl from East Asia, with shoulder-length straight hair and soft bangs that are a bit disheveled by the wind, is lost in thought as she gazes into the distance. She has delicate natural features, fair skin and a touch of sunlight, with lustrous lips. She is wearing a Japanese high school girls' uniform: a white sailor jacket with a dark blue large lapel and white striped edges, a red bow ribbon tied around her chest, and a dark blue pleated skirt. Soft outdoor natural light during the day, clear blue sky background, gentle bokeh, shallow depth of field, highly detailed skin texture, realistic photography, cinematic atmosphere, realistic, 8k, masterpiece.
这里发现一个bug,如果把服装换成汉服,例如穿着中国传统汉服:淡粉色交领上襦,绣有精致的梅花图案,搭配浅绿色齐腰襦裙,腰间系着白色丝绸腰带,衣袂飘飘,人物会从青少年会变成孩子。
经调查,这属于训练数据偏差导致的常见问题,有可能是汉服数据集中青少年和成年数据不完整,并且和儿童数据有重叠导致的偏差。因此有针对性的补充年龄信息后可以得到需要的图片。
可以看到,总体而言,用z-image生成的人像是相当不错的。
自然风景
从bing壁纸找一张,尝试让z-image生成类似的图片。
Breathtaking landscape of Mount Egmont (Taranaki) at sunrise or sunset, perfectly symmetrical snow-capped volcanic peak with a distinctive lenticular cloud cap hovering above the summit. The mountain is partially shrouded in soft mist and low clouds, golden warm sunlight illuminating the slopes. In the foreground, a calm reflective tarn (small lake) with mirror-like water perfectly reflecting the mountain, clouds, and sky. Lush green and golden tussock grassland around the water's edge. Clear blue sky with scattered soft pink and orange clouds, serene and majestic atmosphere, ultra-detailed, highly realistic photography, sharp focus, cinematic composition, golden hour lighting, 8k, masterpiece, national geographic style.
产品宣传图片
高端现代4盘位NAS服务器产品宣传图,优质黑色网络附加存储设备,前面板蓝色LED指示灯发光,多个热插拔硬盘托架清晰可见,居中放置在反射玻璃表面上的专业工作室场景。戏剧性电影级照明,柔和蓝白边缘光突出金属质感和接口,设备周围飘浮全息图标代表云同步、数据备份、多媒体流媒体、安全防护和高速网络连接。深色渐变背景带有抽象数字数据流和细微粒子效果,传达速度、安全与可靠性。超详细产品渲染,逼真摄影风格如同苹果或Synology广告,锐利对焦、高对比度、鲜艳却专业的色彩,8k分辨率,杰作,最佳品质。
手机壁纸
Dramatic night sky photography of a bright comet streaking diagonally across a deep blue starry sky, with stars appearing as soft circular bokeh lights due to long exposure. In the foreground, a silhouetted lone person standing on a snowy hill, holding a flashlight pointed upwards illuminating a bare leafless tree beside them, creating a beam of light and subtle glow on the branches. Vast open snowy landscape with faint tracks, serene and mysterious atmosphere, winter night, high contrast silhouette against the celestial sky, ultra-detailed astrophotography, long exposure effect, photorealistic, cinematic composition, 8k, masterpiece.
二次元
Anime screenshot from Lycoris Recoil, **Chisato Nishikigi** with short blonde hair tied with a red ribbon tassel, red eyes, gentle smile, resting her head on her hand while sitting on a train seat. She wears a red jacket with gold buttons, white shirt, and blue ribbon tie. View from inside the train looking out a rain-streaked window with water droplets, revealing a misty rainy rural Japanese landscape with green mountains, scattered houses, fields, and overcast gray sky. Melancholic and serene atmosphere, soft diffused lighting, highly detailed anime style by A-1 Pictures, intricate rain effects on glass, beautiful composition, masterpiece, official art.
Beautiful anime illustration of two cute girls inside a train during sunset, cozy and serene atmosphere. On the left, a girl with long flowing purple hair and bangs, wearing a school uniform with black jacket featuring red and green stripes, gently holding a steaming purple mug and looking softly at her companion. On the right, a sleepy blonde girl with twin tails and white hair, eyes closed, head resting on her arms on the table, wearing a light blue sweater with a brown ribbon. Table with cups and a phone, viewed through train window showing breathtaking snowy alpine mountains bathed in warm golden-pink sunset light, small village with houses below, soft glowing particles in the air, highly detailed digital art, intricate lighting and shadows, warm color palette, emotional and peaceful mood, masterpiece, ultra-detailed, 8k, anime style by popular artists like torino aqua or ilya kuvshinov.
Anime-style illustration of a cute girl with short dark blue hair and large blue eyes, wearing large over-ear headphones and an oversized loose white button-up shirt (unbuttoned at the top), sitting relaxed on a wide windowsill in a cozy apartment during sunset. A brown and white cat sits beside her on the sill, looking out the window. Warm golden-orange sunset light streaming through the large window, illuminating the room and casting soft glows on her face and the cat. Outside the window: cityscape with buildings silhouetted against a beautiful orange-pink sky. Inside: small round table with a DSLR camera, smartphone, scattered papers, potted plant, photos pinned on the wall, soft and peaceful atmosphere, highly detailed digital art, warm color palette, intricate lighting and shadows, lo-fi vibes, emotional and serene mood, masterpiece, ultra-detailed, 8k, anime style by artists like loundraw or ask (askzy).
1girl, solo, blonde hair, long hair, blue eyes, rabbit ears, animal ears, large breasts, kimono, manga, playful, stuffed toy, vibrant colors
Digital illustration of a blonde-haired anime girl with long hair and blue eyes wearing a floral kimono. She has white rabbit ears on her head and is posed playfully in a traditional Japanese room with sliding shoji doors. A stuffed rabbit toy is visible in the background. The image features vibrant colors and detailed shading, emphasizing the cosplay and manga style.
1girl animal ears anime blonde hair blue eyes breasts character cleavage cosplay cute digital art floral kimono floral print girl illustration japanese clothes Japanese culture Japanese room kimono large breasts long hair looking at viewer manga playful rabbit ears shoji doors smile soft lighting solo stuffed toy traditional vibrant colors
同人
Sousou no Frieren (Frieren: Beyond Journey’s End),精灵法师Frieren的特写,白色/银色的长发扎在双低辫子里,尖的精灵耳朵,平静安详的表情,绿色的眼睛微微向侧面看,露出淡淡的微笑。她穿着一套白色和金色相间的高领服装,戴着一枚红色宝石胸针。她的右手食指向上指,发出明亮的魔法光(星形闪光),用民间魔法吸引或捕捉一只可爱的棕色小鸟,它栖息在她的肩膀上,周围有微妙的魔法线,Frieren轻微歪着头看向小鸟。黑暗模糊的森林背景与绿色的树叶,柔和的神奇的光芒照亮她的脸,高度详细的动画风格由疯癫院,复杂的照明和微妙的魔力效果,宁静和异想天开的气氛,杰作,官方艺术。
名人
特朗普和周星驰电影中的如花在舞台上跳芭蕾舞,杰作、8K,真实舞台感,舞台灯光突出人物
可以看出,z-image的人物数据库是比较“轻量”的,一切非最著名的形象信息是没有的。例如,尝试生成《凡人修仙传中》的人物形象,发现模型不认识。
训练数据源
对于z-image可以生成大量名人形象,有人测试过z-image的训练数据源里到底都有谁,有兴趣可以去阅读原文:

获取提示词
从图片提取提示词
对于z-image生成的图片,提示词和参数等信息,是记录到png图片的元数据中的。因此可以通过元数据工具直接查看生成该图片的提示词,或者把图片重新拖动到ComfyUI的界面中,也可以自动还原其工作流和参数信息。可以使用exiftool查看元数据信息,例如:
exiftool z-image_00091_.png
也可以使用如下代码查看其元数据:
from PIL import Image
img = Image.open("z-image_xxxxxx_.png")
print(img.info)
执行输出如下:
$ python meta_view.py
...
{"inputs": {"text": "1girl, solo, blonde hair, long hair, blue eyes, rabbit ears, animal ears, large breasts, kimono, manga, playful, stuffed toy, vibrant colors\\nDigital illustration of a blonde-haired anime girl with long hair and blue eyes wearing a floral kimono. She has white rabbit ears on her head and is posed playfully in a traditional Japanese room with sliding shoji doors. A stuffed rabbit toy is visible in the background. The image features vibrant colors and detailed shading, emphasizing the cosplay and manga style.\\n1girl\\nanimal ears\\nanime\\nblonde hair\\nblue eyes\\nbreasts\\ncharacter\\ncleavage\\ncosplay\\ncute\\ndigital art\\nfloral kimono\\nfloral print\\ngirl\\nillustration\\njapanese clothes\\nJapanese culture\\nJapanese room\\nkimono\\nlarge breasts\\nlong hair\\nlooking at viewer\\nmanga\\nplayful\\nrabbit ears\\nshoji doors\\nsmile\\nsoft lighting\\nsolo\\nstuffed toy\\ntraditional\\nvibrant colors"
...
从网站获取提示词
很多AI图片网站都提示图片的提示词信息,可以直接拿来出图,例如:
等
让AI自动生成提示词
如果你已经找到一张好看的图片,可以直接把图片扔给多模态的大语言模型,直接问AI这张图片的提示词应该是什么。
结论
跟SD中其他的图像生成模型相比,Z-Image最大优势是低配置高质量,尤其在生成逼真人像方面非常出色。