֍
Learn how to use masked image generation techniques using StableDiffusionXLControlNet and StableDiffusionXLInpaint.
![image](/_next/image?url=https%3A%2F%2Fmedia.substrate.run%2Flogo-atlantis-1.jpg&w=640&q=75)
Generate illusions
![no background](/_next/image?url=https%3A%2F%2Fmedia.substrate.run%2Fex-cn-inpaint.webp&w=640&q=75)
Edge variation and inpainting
We'll cover two workflows that use masked image generation:
- Generate illusions: StableDiffusionXLControlNet with the
illusion
method generates illusions incorporating the mask. - Edge variation and inpainting: StableDiffusionXLControlNet with the
edge
method generates variations of an image using edge detection, and StableDiffusionXLInpaint generates inside the mask.
First, initialize Substrate:
Here's the original image:
![original](/_next/image?url=https%3A%2F%2Fmedia.substrate.run%2Flogo-sq.png&w=640&q=75)
1. Generate illusions
This workflow uses RemoveBackground to generate a mask, followed by StableDiffusionXLControlNet with the illusion
method to generate a two images incorporating the mask into a view of the ocean from above:
![image](/_next/image?url=https%3A%2F%2Fmedia.substrate.run%2Fillusion-1.jpg&w=640&q=75)
![no background](/_next/image?url=https%3A%2F%2Fmedia.substrate.run%2Fillusion-2.jpg&w=640&q=75)
Experimenting with different prompts can produce striking results:
![image](/_next/image?url=https%3A%2F%2Fmedia.substrate.run%2Flogo-atlantis-1.jpg&w=640&q=75)
![no background](/_next/image?url=https%3A%2F%2Fmedia.substrate.run%2Flogo-atlantis-2.jpg&w=640&q=75)
2. Edge variation and inpainting
This workflow uses StableDiffusionXLControlNet to generate a variation of the original, and StableDiffusionXLInpaint to generate a variation inpainting inside a mask.
![image](/_next/image?url=https%3A%2F%2Fmedia.substrate.run%2Fex-controlnet.jpeg&w=640&q=75)
res.get(controlnet)
![no background](/_next/image?url=https%3A%2F%2Fmedia.substrate.run%2Fex-cn-inpaint.webp&w=640&q=75)
res.get(inpaint)