How to Create QR Code Art Using Stable Diffusion WebUI

Introduction

 

AI art is getting increasingly popular. Despite its visual aspect, there are not many options for how you can utilize it. An excellent new technique of generating AI art might be helpful for brand communication or even merch production - a new way to utilize QR codes. Let’s learn how to generate AI art with a readable QR code!

 

1. Download and install Stable Diffusion WebUI  

 
First, download the Stable Diffusion WebUI repo from Automatic1111 github and install it following the instruction in the following links.

 

2. Install the ControlNet extension for this UI

As you have installed the WebUI, go to the “extensions tabs” and then to the “available” tab. Find “ControlNet,” click “install,” and then restart your WebUI.

An alternative extension install method is to install from the URL:

 

3. Download 3 models

Download the tile ControlNet model - control_v11p_sd15_lineart.pth

Download the brightness ControlNet model - control_v1p_sd15_brightness.safetensors

And place these downloaded models in the stable-diffusion-webui/extensions/sd-webui-controlnet/models directory.

 

https://civitai.com/models/36520/ghostmix

Download the ghostmix model, and put it into stable-diffusion-webui/models/Stable-diffusion directory.

 

4. Let's generate a QR code

We won't use AI to generate a QR code, but we will use an existing one as an input image. There are many free websites. I am using the DNSCHECKER, and you can use any site you prefer. Choose "error correction level:L" and image size 250x250 and download the generated image.

5. Everything's set up, let's generate!

In AUTOMATIC1111 WebUI, navigate to the Img2img page.

Step 1: Select a checkpoint model. We will use GhostMix.

Step 2: Enter a prompt and a negative prompt.

The prompt is quite important to your success. Some prompts blend naturally with your QR Code.

 
We will use the following prompt.
a cubism painting of a town with a lot of houses in the snow with a sky background, Andreas Rocha, matte painting concept art, a detailed matte painting

 

And the following negative prompt.
ugly, disfigured, low quality, blurry, nsfw
 

Step 3: Upload the QR code to the img2img canvas.

 

Step 4: Enter the following image-to-image settings.

  • Resize mode: Just resize
  • Sampling method: DPM++2M Karras
  • Sampling step: 50
  • Width: 768
  • Height: 768
  • CFG Scale: 7
  • Denoising strength: 0.75

Step 5: Upload the QR code to ControlNet‘s image canvas.

 

Step 6: Enter the following ControlNet settings.

  • Enable: Yes
  • Control Type: Tile
  • Preprocessor: tile_resample
  • Model: control_xxx_tile
  • Control Weight: 0.87
  • Starting Control Step: 0.23
  • Ending Control Step: 0.9

Step 7: Press Generate.

 

Step 8: Check the QR code with your phone. 

Make sure to check with different sizes on the screen. Some tend to have issues when they are large. You won’t get a functional QR Code with every single image. The success rate is about one in four. Generate more images and check for the keepers.

Conclusion & Tips

In this tutorial, you will learn how to make AI art with a readable QR code with Stable Diffusion WebUI. You can play around with the ControlNet settings to manipulate results according to the prompt, reducing or increasing the control weights. This process works better with smaller QR codes and high fault tolerance. It might take some tries to generate the right image.

Add Feedback