Exploring the Artistic Side of QR Codes with Generative AI: Stable Diffusion and ControlNet

Kamran Shahid
6 min readJul 2, 2023

--

Imagine a world where QR codes are not just functional, but also visually captivating. A world where these small, square barcodes are not just a means to an end, but an end in themselves — a piece of art. This is no longer a figment of imagination, but a reality made possible by the power of Generative AI.

In this article, I’ll take you on a journey through my experiments with Stable Diffusion with ControlNet, a powerful tool in the field of generative AI. Together, we’ll explore how these tools can transform ordinary QR codes into extraordinary art pieces.

Stable Diffusion and ControlNet

Stable Diffusion and ControlNet are powerful tools in the field of generative AI. Stable Diffusion is a generative model that uses a stochastic process to generate new samples. At the same time, ControlNet provides more control over the generative process, allowing you to define object boundaries in your image.

Creating Artistic QR Codes

Creating artistic QR codes with Stable Diffusion and ControlNet is a fascinating process. In my setup, I’ve used AUTOMATIC1111’s Stable Diffusion Web UI interface and the GhostMix checkpoint model to generate QR code art on my computer. For the ControlNet preprocessor, I’ve used ‘Tile’. This combination has allowed me to create unique and visually appealing QR codes.

Refer to this tutorial for a detailed guide to setting up your system for generating artistic QR codes.

Alternatively, if you want to generate artistic QR codes without setting up your system, you can use this project hosted on Hugging Face. However, please note that the results from this project for me were less refined than those generated with my setup.

My Prompts and Outcomes

I invite you to try scanning the QR code images I’ve shared in this section. How many are you able to scan successfully?

Feel free to share your results in the comments. This will help you understand the generated QR codes’ effectiveness and provide valuable feedback for further improvements.

Here are the prompts I used and the QR codes I got :-

Mountains

Prompt: RAW photo, a QR code embedded in a detailed painting of a serene mountain landscape, high detailed nature:1.2, 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm XT3

Negative Prompt: deformed QR code, ugly, disfigured, low quality, blurry, nsfw

City Skyline

Prompt: A minimalistic, digital art of a modern city skyline at dawn, inspired by the art of Yoko Honda, high definition, 4K resolution, pastel color palette, intricate detailing.

Negative Prompt: deformed QR code, ugly, disfigured, low quality, blurry, nsfw

Village

Prompt: A high-definition, 4K resolution image of a quaint village nestled in the heart of a lush green valley during spring.

Negative Prompt: deformed QR code, ugly, disfigured, low quality, blurry, nsfw

Mage Protagonist (Anime)

Prompt: A high-definition, 4K resolution image of a mysterious male anime character with long flowing hair, wielding a magical staff.

Negative Prompt: deformed QR code, ugly, disfigured, low quality, blurry, nsfw

Futuristic Protagonist (Anime)

Prompt: A high-definition, 4K resolution image of a confident anime character with glowing eyes, wearing a futuristic armor suit.

Negative Prompt: deformed QR code, ugly, disfigured, low quality, blurry, nsfw, text, close up, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck.

HuggingFace QR Image Generator

There are two prompts I ran on this project, and the outcomes for these two are:

Prompt: a tranquil seaside town at sunset with boats bobbing in the harbor.

Negative Prompt: ugly, disfigured, low quality, blurry, nsfw

Prompt: a rustic village surrounded by rolling green hills and a clear blue sky

Negative Prompt: ugly, disfigured, low quality, blurry, nsfw

Challenges and Workarounds

While Generative AI has made significant strides in creating visually appealing QR code art, some challenges remain. For instance, the AI may struggle with certain elements, such as text. Additionally, the stylized QR codes may not be easily scannable by all devices or QR scanning apps. In some cases, you might need to step back and scan from a distance for the codes to work.

Moreover, the generation process does not always result in working QR codes. It may take several attempts (3–4 tries) to generate a working QR code, so generating them in batches is recommended. Personally, I generate them in batches of 8.

While all of the QR codes presented in this article can be easily scanned using my device, your results may vary depending on your device and the QR scanning app you use.

Conclusion

The transformative potential of Generative AI in reshaping the humble QR code into a visually captivating piece of art is nothing short of extraordinary. It breathes new life into these functional tools, turning them into aesthetic masterpieces that can engage audiences in a whole new way.

The applications are boundless, from crafting eye-catching QR codes for marketing initiatives to generating one-of-a-kind QR code art for merchandise. We’re standing at the precipice of a new era in QR code design, one that’s being sculpted and powered by the formidable force of AI.

As we continue to explore and experiment with these technologies, who knows what other creative avenues we might uncover? One thing’s for sure: the future of QR code design is here, and it’s more exciting than we could have ever imagined.

Stay tuned to my tech journey by following me on Medium. And if you want to join forces and conquer the tech world together, let’s connect on LinkedIn!

--

--

Kamran Shahid
Kamran Shahid

Written by Kamran Shahid

Experienced Android developer building quality, scalable, and user-friendly apps. Sharing my insights on mobile development.

No responses yet