How to use Stable Diffusion AI to create amazing images

Stable Diffusion generating an image

Image: Screenshot by Lance Whitney/ZDNET

The popularity of AI has led to a host of websites and services that are able to create an image from a text description or prompt. One option worth trying is Stable Diffusion. 

An effective and versatile tool, Stable Diffusion is available through a range of websites and as a standalone application. Simply type your description, and it generates corresponding images. Here's how it works.

Using the various Stable Diffusion websites

As a text-to-image model, Stable Diffusion is accessible through various websites.

Stable Diffusion Online

Use your browser to go the Stable Diffusion Online site and click the button that says Get started for free. At the field for Enter your prompt, type a description of the image you want to generate. Then click the Generate image button. In response, the site displays four images by default.

Four images generated

View the generated images.

Image: Screenshot by Lance Whitney/ZDNET

Click one of the four generated pictures and you can view it in a larger size. You can switch between the four images by clicking its thumbnail. Right-click on an image to display your browser's menu, which allows you to save, copy, or email the image.

An image enlarged

Image: Screenshot by Lance Whitney/ZDNET

If you're not happy with any of the suggested images, just try again. Keep the same prompt, but click the Generate image button to see four different images based on your description.

A set of four new images

Image: Screenshot by Lance Whitney/ZDNET

Hugging Face

1. Generate an image

Another website that uses the Stable Diffusion model is Hugging Face. Browse to the site and type your description at the prompt. 

You should notice that there's also a field for Negative prompt. Here, you're able to type text and suggest anything you don't want to include in the image. Click the Generate Image button, and four images appear in response.

Four generated images

Image: Screenshot by Lance Whitney/ZDNET

2. Select an image

Click a specific image to view it. Right-click on the image to save or copy it.

An enlarged image

Image; Sscreenshot by Lance Whitney/ZDNET

DreamStudio

DreamStudio is another site that uses the Stable Diffusion model. However, this time you'll need to sign in with a supported account. You should also be aware that DreamStudio offers you a certain number of free credits that count toward generating images. If you use up those credits, you'll have to pay for more to continue using the site.

Also: How to use Bing Image Creator (and why it's better than DALL-E 2)

Browse to the Stability.AI login page. You can either log in with an existing Google or Discord account or click the sign up link at the bottom to create a new account. After signing in with your account, you're taken to the DreamStudio website where you can log in.

Before you can generate an image, you'll want to select a couple of options. First, click the field for Model and choose the version of Stable Diffusion you want to use — either one of the production versions or the latest beta. Next, click the Style field and choose the type of style you'd like for your image, such as Anime, Photographic, Comic Book, Cinematic, or 3D Model.

Also: This new technology could blow away GPT-4 and everything like it

Under Settings, move the first slider to set the size of the image. Then move the second slider to choose how many images you wish to see.

1. Generate an image

Type your text description in the prompt. You can also exclude certain items from the image by adding them in the Negative prompt. When ready, click the Dream button. In response, the site displays the number of images that you selected in Settings.

The generated images on display

View the generated images.

Image: Screenshot by Lance Whitney/ZDNET

2. Select an image

Click an image to see a larger version. Right-click the image to save or copy it.

Image with the browser's menu

Image: Screenshot by Lance Whitney/ZDNET

Download and install Stable Diffusion

Rather than relying on the different websites that use Stable Diffusion as a model, you can install the program on your computer. However, be forewarned that setting up the application is challenging and requires several precise steps. The good news is that, once you're done, you can run it whenever and how often you want.

Also: The best AI art generators to try

Before you get started, you'll need to make sure your PC meets the minimum requirements: Windows 10 or 11, and a discrete NVIDIA video card with 4GB or more of VRAM. You can check the name and model of your video card and the amount of VRAM via the DirectX Diagnostic Tool. Press Win key+R to trigger the Run box. In the Open field, type dxdiag. In the DirectX Diagnostic Tool window, click the Display tab to see the name of your card and the amount of VRAM. 

If your card is up to snuff, go through the following steps:

1. Install Python

Browse to the Python 3.10.6 website. Scroll down to the Files section and click the link for the Windows installer (64-bit) (assuming you're running 64-bit Windows). Run the downloaded file to install Python.

2. Install Git

Browse to the Download page for Git for Windows. Click the link for 64-bit Git for Windows Setup. Install the downloaded file, accepting all the default options.

3. Download the Stable Diffusion project file

Browse to the GitHub page for the Stable Diffusion project file. Click the green Code button in the upper right and select Download ZIP. Extract the downloaded ZIP file. Doing so creates a folder named stable-diffusion-webui-master. Copy this folder with all the extracted files to a simple location, such as the root of your C: drive.

4. Download and set up the checkpoint file

Browse to the Hugging Face webpage for the Stable Diffusion checkpoint file. Click the download link to save the 768-v-ema.ckpt file. This is a huge file, so be patient while it downloads. After the file has downloaded, navigate to the following location: C:stable-diffusion-webui-mastermodelsStable-diffusion (assuming you copied this folder to the root of your C: drive). Inside this folder is a file named Put Stable Diffusion checkpoints here.txt. Copy the 768-v-ema.ckpt file into this folder.

5. Download the config yaml file

Browse to the page for the config yaml file. The file will appear as straight text. Right-click anywhere on the page and select Save as. Navigate to the C:stable-diffusion-webui-mastermodelsStable-diffusion folder and save the yaml file in this location. Change the name of the file to 768-v-ema but keep the yaml extension, so it should be named 768-v-ema.yaml.

6. Run the webui-user.bat file

Move to the stable-diffusion-webui-master folder and run the webui-user.bat file. After a couple of minutes, the window should display a line that reads: Running on local URL, followed by a URL with the IP address of your local machine and a port number. Copy and paste that entire URL with the port number into your favorite browser to display the Stable Diffusion application. However, keep the command window open.

7. Generate an image

Now you can finally generate an image. In the Stable Diffusion application, type a description for the image you want at the prompt. Enter any text you wish to exclude in the Negative prompt. If you want to, you can change the parameters for Sampling method, width, height, and the rest. Set values for Batch count and Batch size if you need to change the defaults. When ready, click the Generate button. The application displays the images based on the count you requested.

The generated images

Generate and view the images.

Image: Screenshot by Lance Whitney/ZDNET

Peek around the Stable Diffusion application and you'll find a host of other options, including ones to upload an image to generate a variation of it, scale and otherwise tweak an image, and tap into different extensions. 

If you find an image you like, click it to enlarge it. Click the Save or Zip button to save it. Otherwise, all the generated images are automatically saved in a folder that you can access by clicking the Folder button.

all the generated images saved on your PC

View all the saved images.

Image: Screenshot by Lance Whitney/ZDNET

Source