You’ve probably seen these beautiful AI QR codes going viral on Twitter. In this article, I will show you how to create these AI QR codes using stable diffusion and control net. After multiple failed attempts, I was finally able to create working AI QR codes, and I will share with you what worked for me.
Prerequisites
Before we get started, make sure you have Stable Diffusion and Control Net installed. You’ll also need a QR code. You can generate one using any QR code generator website or tool. For this tutorial, I used Kerem Erkan’s QR Code Generator.
- Enter your URL.
- Under “Error Correction Level,” select “High.”
- Generate your QR code and download it.
Creating the AI QR Code
- Go to Canva.
- Click on “Create a Design” and select a custom size. You can use either 512×512 or 768×768 pixels.
- Upload the QR code you generated and drag it onto the canvas.
- Click on “Share,” then select PNG and download the QR code.
Setting Up Control Net Models
- Visit the following link: DionTimmer/ControlNet_QRCode.
- Click on the “Files and Versions” tab.
- Download the sd21 and sd15 safe tensors and YAML files.
- Save these files to the ControlNet folder of your Stable Diffusion models installation directory. For me, it’s (D:\stable-diffusion-webui\models\ControlNet)
Using Stable Diffusion and Control Net
- Open Stable Diffusion, or if it is already open, click on the blue refresh button under Control Net to ensure the models are installed properly.
- Choose which stable diffusion checkpoint you want to use, either a 2.1 or 1.5 model. Note that results may vary, and I found better success with the 2.1 model.
- Drag and drop your QR code into the Control Net section and enable it.
- Under Preprocessor, select “Invert.”
- Select the sd21 QR Code model.
- Set the control weight to 1.6.
- Leave the preprocessor resolution at 512 and set the preprocessor resolution to 768.
- Prepare your prompt. For example, you can use the prompt “ONLY a HEAd with neural link from a cyborg with glowing cables.”
- Click on “Generate” and wait for the results.
Testing and Fine-Tuning
Scan the AI-generated QR codes with your phone’s camera to see which one works. You might need to adjust the control weight to achieve better results. In my testing, a control weight of 1.3 produced slightly better results. Additionally, you can experiment with different SD models such as the “Illuminutty-Diffusion” model.
Enhancing QR Codes
If you are not satisfied with the appearance of the AI-generated QR codes, you can further customize them using image editing software like Adobe Photoshop. Apply filters, adjustments, or add effects to make the QR codes more visually appealing.
Exploring Image-to-Image Generation
You can also use Stable Diffusion and Control Net to generate AI images based on existing images. Simply generate an image you want to use and then take it to the “Image-to-Image” tab. Keep the settings default but use the same Control Net settings. Experiment with different prompts and models to achieve desired results.
Other Experiments
You can try generating AI images without using a prompt, but note that results may vary. Combining multiple control nets and experimenting with different settings might help improve outcomes.
Conclusion
Now that you know how to create AI QR codes, you can start experimenting and creating your own unique designs. Remember, the results may vary depending on the models, prompts, and settings you use. Feel free to share your thoughts, tips, and tricks in the comment section below. Have fun exploring the world of AI QR codes!