Img2Img教程:AI图像转换完全指南
Img2img把一张图变成另一张:草图变插画、照片变动漫、低清变高清。
Img2Img Tutorial 2026: Transform Images With AI - The Complete Guide
Img2img (image-to-image) uses a diffusion model's denoising process to transform an existing image instead of generating from pure noise. It is the mechanism behind style transfer, sketch-to-render, inpainting, and upscaling. Every major tool - ComfyUI, Automatic1111, FLUX workflows - exposes it as a checkbox.
How It Works (the denoising insight)
Diffusion generates by adding noise, then removing it. Img2img starts from YOUR image at a chosen noise level instead of random noise:
- Low denoising strength (0.2-0.4) - image mostly keeps its structure; changes style and details
- Medium (0.4-0.7) - transforms composition while keeping recognizable shapes
- High (0.7-1.0) - near-total regeneration; the input is just a hint
The 4 Practical Use Cases
1. Style transfer Input: your photo. Prompt: "in the style of studio ghibli". Strength 0.5. Result: your photo's composition with a new art style.
2. Sketch to render Input: line drawing. Prompt: "detailed digital painting". Strength 0.7. The model follows the sketch structure and fills in color, lighting, texture.
3. Photo restoration Input: old/damaged photo. Strength 0.3 + inpainting mask on scratches. Restores detail without changing the person.
4. Upscaling with detail Input: low-res image. Strength 0.3-0.4 at 2x resolution with a good model (FLUX Dev or SDXL). Adds realistic detail rather than just blurry resizing.
ComfyUI Minimal Workflow
Load Image -> VAE Encode -> KSampler (denoise=0.5) -> VAE Decode -> Save
^
CLIP Text Encode (prompt)
The key: set the KSampler's denoise value instead of 1.0.
Parameter Cheat Sheet
| Goal | Denoise | Prompt weight |
|---|---|---|
| Change style, keep scene | 0.3-0.5 | Strong style words |
| Change subject, keep layout | 0.6-0.8 | Strong subject words |
| Full regeneration from hint | 0.8-1.0 | Strong everything |
| Subtle touch-up | 0.15-0.3 | Minimal changes |
FAQ
Img2img vs ControlNet? ControlNet constrains specific structure (pose, edges); img2img diffuses the whole image. They combine well - ControlNet for structure, img2img for style.
What is inpainting? A special img2img mode where only a masked region is regenerated; the rest of the image is untouched. Ideal for fixing one element.
Best free tool for beginners? ComfyUI or Automatic1111 locally (free, open source), or the FLUX img2img demos on Hugging Face.
