How To Generate QR Codes Embedded With AI Art
QR codes are ubiquitous and incredibly useful for quickly sharing small amounts of information. AlthoughQR (short for Quick Response) codeswere originally invented at a Toyota subsidiary company in the 1990s to replace barcodes in keeping track of automotive parts, they have proven to be handy for numerous use cases, ranging fromsharing your Wi-Fi passwordto promoting your business, makingcontactless online payments, and more.
The pandemic has further fueled the popularity of QR codes for digital menus in bars and restaurants so people can avoid touching the virus- and bacteria-filled petri dishes that we call physical menus. Per a recent report byQR Tiger, QR code usage more than quadrupled in 2022 over the previous year, with the U.S. leading in the number of scans.

But despite the countless applications — and equally numerous opportunities for easy advertising, QR codes have barely undergone any significant visual evolution and still mainly comprise a grid of squares, circles, and dots. The advent of AI-generated art finally sets up QR codes for a substantial overhaul, and you can now tastefully create QR codes that completely camouflage with the AI artwork.
How can you merge QR codes with AI-generated art?
Creating unique and highly customized QR codes involves imprinting a basic QR code over an AI-generated image. While one can simply superimpose a semi-transparent version of a QR code on any image, AI comes in handy in seamlessly blending the crude matrix design into a new image.
This is possible through a text-based AI image generation model calledimg2img, part of the more diverse text-to-image deep learning model supergroup called Stable Diffusion. Unlike other popularAI image generatorssuch as DALL-E, Stable Diffusion is free to use. It allows you to add a secondary input and multiple parameters to create the desired output with fewer permutations to the prompt. The img2img model lets you add an image as the starting point for the AI to enhance.

In addition to img2img, the process relies on ControlNet, another Stable Diffusion deep-learning model designed to trace edges from an existing image. WhileControlNetis primarily intended to capture human poses and edges around the human body to create a sense of realism, it works flawlessly at embedding the QR code onto the AI-generated image.
Get a basic QR code
Stable Diffusion Artcomprehensively outlines creating a personalized QR code embedded into AI art. To get started, you must first create a basic QR code in a digital format. While you can use an existing code, we suggest creating a new one.
A simple online search for a “QR code generator” can lead you to countless options to create the initial design. However, since the QR code will be merged into the image, we must make one with a high correction level. A QR code’s correction level (or fault tolerance) represents how much it can be damaged while remaining readable.

QRstuffandQrbtfare free and easy-to-use tools that let you customize the correction level on a QR code. you’re able to add whatever information you want and then choose the correction level of 30%. Avoid adding unnecessary frills and opt for a simple design with square bubbles and dots, as more complex designs may affect the code’s readability when merged with the artwork. Once you have the QR code, we must use Stable Diffusion to create the AI art.
There are two ways to run Stable Diffusion: one method is more straightforward and requires minimal setup, but you must pay for your usage, while the other is completely free but more complex.

Create AI art with QR codes (Easy method) Part 1: Setup
We’ll check out the paid method first, as the free method requires you to download files that take up to roughly 60GB on your PC’s hard drive. It also requires a powerful setup, including a dependable GPU, or rendering images may take several minutes. The paid does not require any setup and can be run on any machine, even a smartphone or tablet, with access to a high-speed internet connection. For this method, we’ll use “Think Diffusion,” an online service that runs Stable Diffusion models on the cloud. Its pricing starts at $.50 per hour, and you get a free trial of 30 minutes. Here’s how to get going:
There are different workflows for interlacing QR codes into AI images. You can either create images from text prompts directly while using ControlNet to embed the QR code into it or create an image and then combine it with the QR code. Both methods work, but we recommend the latter, as it produces more relatively natural blends than combining the process in a single step. While this makes the process longer, the results are much more satisfactory.

Part 2: Creating AI images
We’ll start with the second workflow mentioned above, i.e., creating an image first and then combining it with the QR code. Here’s how to get started in Think Diffusion.
The next part of the process is to use the image as a reference to create something that blends well with the QR code. Follow these steps to accomplish that:
Part 3: Blending AI images with QR code using ControlNet
The next part is to deploy ControlNet to integrate the QR code into the new image using these steps:
This is where the tricky part begins. You will be required to fiddle with multiple values for Denoising strength and the QR code’s Control Weight, Starting Control Step, and Ending Control Step to get the desired result. As each of these values ranges from 0 to 100, it leads to hundreds of combinations, and you must go over many of those and sometimes still not reach the expected end goal, like this:
If you’re determined to create the perfect QR code, you may try the free method below to bypass limitations with time.
Stable Diffusion for Windows: Free Method
To run Stable Diffusion on your PC, you must download and install a web interface called AUTOMATIC1111. The PC version is free to use but requires experience with Windows’s Command Prompt. Follow these steps to set up Stable Diffusion on a Windows PC:
Set up Stable Diffusion on Mac: Free Method
Like Windows, running Stable Diffusion on Mac involves installing Python, cloning the Stable Diffusion git, and installing checkpoint files.
Here are the steps for you to follow:
One final step before you start
You will see a simple interface for creating AI images once you open the Stable Diffusion Web UI. There is one last but essential step before creating images — installing ControlNet using these steps:
With all the resources in place, you can begin using ControlNet inside Stable Diffusion.
Generate AI masterpieces with QR codes
The process is similar to what we described in the paid method above, with minor differences. Here’s a quick refresher:
You might have to tweak the Denoising strength and the ControlNet parameters before reaching the desired result. It may be a long and frustrating process, and it can be challenging to get perfect results, so brace yourself and keep trying.