Create QR Codes with Stable Diffusion (QR Code Monster)

Create QR Codes with Stable Diffusion (QR Code Monster)
Learn to create QR codes that are both functional and visually impressive with Stable Diffusion and ControlNet!

1. Introduction

A Quick Response code, or QR code, is a visual representation that encodes various data, such as text or URLs. These codes can be swiftly scanned using a smartphone's camera, providing instant access to the embedded content. QR codes have gained broad acceptance in diverse domains, spanning from marketing campaigns to touchless transactions. Explore the art of crafting visually striking QR codes, as we harness the capabilities of the QR Code Monster model within ControlNet. Learn how to create QR codes that are not only functional but also visually astonishing.

2. Requirements for QR Code Art

To create QR codes with Stable Diffusion, we will utilize the AUTOMATIC1111 Stable Diffusion GUI.

Make sure you have the following installed to create stunning QR codes:


Once you have downloaded the model using the provided link, you can simply move them to your ControlNet models folder. Stable-diffusion-webui\extensions\sd-webui-controlnet\models

Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds
20% bonus on first deposit

3. Generate a QR Code

Before proceeding with Stable Diffusion, you need a QR code that meets certain criteria for better results. Ensure that the QR code:

  • Uses a high fault tolerance setting (30%).
  • Has a white margin (quiet zone) around it.
  • Utilizes a basic square fill with a black-and-white pattern.
  • Avoids generators that introduce thin white lines between black elements.
  • Download the QR Code as a PNG file.

Use a Free QR Code Generator to meet the above criteria. I recommend Anthony’s QR Toolkit, this is an advanced QR Code Editor that lets you adjust a lot of criteria for the QR Code. While you can adjust the QR code to your liking I do recommend a couple values.

  • Error Correction: H
  • Margin: 4
  • Pixel Size: 20


4. Stable Diffusion Settings (Txt2img)

In the creation of captivating QR codes, we employ Stable Diffusion's txt2img function in tandem with the QR Code Monster model. Our journey commences by generating an initial image devoid of the QR code. Subsequently, as the generation unfolds, ControlNet seamlessly integrates the QR code into the artwork. Towards the final stages of this creative process, we turn off ControlNet, thereby enhancing the QR code's concealment and ensuring the image's overall consistency. Access the txt2img page in the AUTOMATIC1111 WebUI.

  • Select a checkpoint model of your choice.
  • Enter a prompt and a negative prompt.

The choice of prompts is crucial for success. mastering-stunning-qr-codes-with-stable-diffusion-qrcode-monster-prompt.webp

Txt2img Settings

Set the txt2img settings as follows:

  • Sampling method: DPM++2M SDE Karras
  • Sampling step: 30-40 (You can play around with the sampling steps but I recommend at least 30 steps)
  • Width: 768
  • Height: 768
  • CFG Scale: 7

Hires. fix Settings

Next we will enable Hires. fix and adjust the following settings.

  • Upscaler: ESRGAN_4x
  • Hire steps: 20
  • Denoising strength: 0,3
  • Upscale by: 1,25 - 2

mastering-stunning-qr-codes-with-stable-diffusion-qrcode-monster-txt2img-settings.webp I discovered that boosting the resolution with Hires Fix makes the QR Code scan more smoothly. However, it does take longer to generate. I suggest starting without Hires Fix, perfecting the image, and then generating it once more with Hires Fix enabled using the same seed.

Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds

5. ControlNet Settings

Now that the txt2img settings are set up we move to the more advanced ControlNet settings. It’s important to note that these settings worked the best for me, with these specific settings, prompts and checkpoints. So when adjusting the prompts or checkpoints you will need to slightly modify the ControlNet settings, I will explain how and what but we first start with the basic settings and adjust from there. First of all drag your QR code in the ControlNet unit and enable ControlNet. Now adjust the following settings:

  • Pixel Perfect: Yes
  • Preprocessor: None
  • Model: qrcode_monster
  • Control Weight: 1,8 (Can be adjusted)
  • Starting Control Step: 0,2 (Can be adjusted)
  • Ending Control Step: 0,8 (Can be adjusted)
  • Control Mode: Balanced


Now you’re all set to generate! I recommend having your mobile device ready to test your QR code as soon as it is done generating (use a QR Code Scanner app). Then we have the ability to instantly adjust the parameters if the QR code is for example; not scannable or too much.

6. Perfecting the ControlNet Settings

Once you've configured your setup and generated the initial image, you may find that you're not entirely satisfied with the result. This is the point at which we refine the ControlNet settings to address any issues. You can follow a few straightforward steps to achieve this.

If you're content with the image, ensure you use the same Seed when regenerating it by clicking on the recycle icon next to Seed. This consistency helps maintain the aspects you like in the generated image.

QR code is not scannable.

  • Increase the Control Weight and Ending Control Step, use steps of 0,1.

QR code is too visible.

  • Decrease the Ending Control Step and Control Weight, use steps of 0,1.

You can play around with both the Control Weight and the Ending Control Step to find the right balance for your settings. Sometimes it can even be helpful to adjust the Starting Control Step by a small amount. If you spot the QR code in the initial frame of the Live Preview, I suggest increasing the Starting Control Step by increments of 0,05. Otherwise, the QR code might be overly prominent for your preference. Please be aware that it's advisable not to exceed a value of 0,3, as doing so might render the QR code unscannable.

Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds

7. Examples of QR Code Art

In this section, we showcase remarkable examples of QR code art created using Stable Diffusion and ControlNet. Explore these visually captivating and functional QR codes to spark your creativity and see the endless possibilities in combining technology and artistry.

Girl in Snowy Tokyo


Girl in Autumn Forest


Magical Beast Flying Over Abandoned City


Computer Girl


8. Conclusion

In conclusion, this tutorial has equipped you with the knowledge and tools needed to create impressive and functional QR codes using Stable Diffusion and ControlNet. We've covered key steps, from preparing a QR code with specific criteria to fine-tuning the settings for optimal results.

By employing Stable Diffusion's txt2img function alongside the QR Code Monster model, you can seamlessly integrate QR codes into your artwork, enhancing their concealment and ensuring image consistency. The process involves adjusting both Stable Diffusion and ControlNet settings to strike the right balance, creating QR codes that are visually striking yet scannable.

Remember, while this tutorial provides recommended settings, you may need to make adjustments based on your specific prompts and checkpoints. The ability to instantly test and modify your QR code is a valuable asset, ensuring it meets your desired level of visibility and scanability.

With these insights, you're well-equipped to craft QR codes that not only serve their functional purpose but also stand out as visually impressive works of art. Explore the possibilities and create QR codes that captivate and engage your audience.

Frequently Asked Questions

Stable Diffusion's txt2img function collaborates with the QR Code Monster model within ControlNet. The process begins with generating an image without the QR code, then ControlNet smoothly integrates the QR code as the image develops. Toward the end, ControlNet is deactivated, enhancing the QR code's concealment and ensuring the image's overall coherence.

If you're not completely satisfied with the initial image, you can refine ControlNet settings to address issues. Follow these steps:

  • To maintain aspects you like, use the same Seed when regenerating.
  • If the QR code is not scannable, increase the control weight and ending control step in steps of 0.1.
  • If the QR code is too visible, decrease the ending control step and control weight in steps of 0.1.
  • Adjust the starting control step if necessary, incrementing by 0.05.