Image Generation AI with ComfyUI: Inpaint Edition

Progress 10 / 15
Table of Contents

Using Inpaint in Stable Diffusion, you can modify a specific part of an image or add entirely new elements to it while leaving the rest unchanged. The workflow masks the region you want to change, then generates new content for just that area using your text prompt as a guide. Because only the masked region is regenerated, you get precise control over which part of the image changes.

In this article, I explain the specific procedure for performing Inpaint with Stable Diffusion using ComfyUI.

Work Flow

1. Introduction of ComfyUI

Please refer to this article.

【Stable Diffusion】ComfyUIを使って画像生成AIで遊んでみよう【導入編】

>-

blog.otama-playground.com

2. Creation of Workflow

The yellow nodes are the ones I added.

Workflow
Workflow

Referencing the following:
https://comfyanonymous.github.io/ComfyUI_examples/inpaint/

3. Creation of Mask

  1. Right-click Load Image and select the item called Open in Mask Editor.
  2. Paint the part you want to mask black.
  3. Click Save to node to finish.
Option appearing on right-click
Option appearing on right-click
After masking
After masking

Note: The default Mi*key subject had a style mismatch and the result didn’t turn out well, so I gave up on it.

4. Generate

Write what you want to generate in the masked area in your prompt, then generate.

Generation Result

I masked only the sky of the famous Windows XP wallpaper.

Mask Image
Mask Image

Prompt:

apocalyptic scene, meteors falling, stars, colonies, numerous explosions, intense fire, smoke, numerous meteors, dramatic sky, destruction, detailed environment, high-quality, 4K, dynamic lighting, realistic textures, dark atmosphere, cinematic, depth of field, chaos, ruins, concept art, artstation, vibrant colors, embedding:DarkFantasy,

Generated Image
Generated Image

An image with a satisfyingly apocalyptic atmosphere was generated.

Conclusion

This time I explained how to perform Inpainting using Stable Diffusion. By mastering Inpaint, you can mask specific areas and add new elements to them, enabling a wide range of expressive possibilities. I hope this article serves as a useful reference for image editing with Stable Diffusion.

If you want to try other techniques related to image generation, please check out the link collection below.

Stable Diffusionガイド:画像生成に役立つリンク集

>-

blog.otama-playground.com