Cache images with CloudflareBuild a website with Next.jsBuild a Discord bot with PythonBuild an app with SwiftUIPush your own modelPush a Diffusers modelPush a Transformers modelPush a model using GitHub ActionsDeploy a custom modelGet a GPU machine
Home / Guides / Stable diffusion

Image to image (img2img) with Stable Diffusion


Use image-to-image to take the features and structure of a starting image and reimagine them with a prompt. The colors in your original image will be preserved.

Input
prompt
A rainbow coloured tiger
prompt_strength
0.65
Output

Prompt strength (or denoising strength)

This only applies to image-to-image and inpainting generations.

It determines how much of your original image will be changed to match the given prompt.

Higher numbers change more of the image, lower numbers keep the original image intact. Values between 0.5 and 0.75 give a good balance.

When inpainting, setting the prompt strength to 1 will create a completely new output in the inpainted area.

Using prompt strength 0.95

In this example we’ve increased the prompt strength. You can see that the image has changed a lot, it matches the prompt more closely and our original cat is very much a tiger.

Input
prompt
A rainbow coloured tiger
prompt_strength
0.95
Output

Using prompt strength 0.45

If we do the opposite, and reduce the prompt strength, you can see that much more of the original image is preserved. Our cat has only slightly changed, and it’s showing minor tiger-like features.

Input
prompt
A rainbow coloured tiger
prompt_strength
0.45
Output