StableDiffusion: Create Your Personalized QR Code

Aihehe
4 min readJul 31, 2023

--

QR codes have become an indispensable part of our daily lives. Have you ever thought about creating a personalized QR code of your own? In this article, I will show you how to use StableDiffusion to create a personalized QR code.

Preparation

Before we start, we need to download two models: sd_brightness and sd_tile.

  • sd_brightness model: This model allows users to color or recolor grayscale images. In other words, we can use it to recolor the black QR code. You can download this model here.
  • sd_tile model: Conceptually, it is similar to a super-resolution model, but its use is not limited to this. It can also generate details on the same size as the input (conditional) image. That is, we can use it to add more details to the original input picture. You can download this model here.

Creating a Personalized QR Code

With the models and your QR code ready, we can start creating a personalized QR code. This process requires two layers of ControlNet.
First, we use the sd_brightness model to recolor the QR code. According to official recommendations, the control weight of the sd_brightness model should be set between 0.4 and 0.9, and the exit timing should be between 0.4 and 0.9. In my case, I set the weight to 0.6.

Then, we use the sd_tile model to add details to the QR code. The weight of this model does not need to be set too high, just a little bit to make the lines of the QR code more prominent. The weight should be set between 0.1 and 0.2, and the exit timing should be between 0.2 and 0.5. If the QR code cannot be scanned, you can appropriately increase the weight.

Adding Prompt Words

Finally, we need to add prompt words. You can choose any model and then add the prompt words you want.
For example, the prompt words I chose are: (MASTERPIECE:1. 2), (REALISTIC:1. 4), (POST PROCESSING:1. 3), (SHARP FOCUS:1. 3), 8K, mid body shot (85mm photo) , A Woman, Portrait, outdoor, Empire Waist dress, bokeh, wavy hair , (highly detailed body, highly detailed face, highly detailed eye, best quality:1. 2).
The reverse prompt words I chose are: (worst quality:2), (low quality:2), (normal quality:2), lowres quality, ((monochrome)), ((grayscale)), <badhandv4>, (deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime:1.4),easynegative, (badhandv4), (worst quality:1.3), (low quality:1), (normal quality:1.4), lowres, skin spots, acnes, skin blemishes, age spot, glan, extra fingers, fewer fingers, strange fingers, bad hand, bad anatomy, fused fingers, missing leg,missing arms,mutated hand, missing hand ,malformed limbs, missing feet,multiple legs, multiple arms, extra hands, extra foots, bad-artist, ng_deepnegative_v1_75t, Brav5Neg,(((cropped))), (deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime:1.4), ((text)),((logo)), out of frame, jpeg artifacts, ugly arms, extra legs, too many fingers, long neck,(((strabismus))),missing eye.

Final Result

Following the above steps, we can get a personalized QR code. Below are some examples of personalized QR codes I made:

Change the prompt word to: a boat in the middle of the cherry blossoms, in the style of lush scenery, fairycore, cute and dreamy, pink and green

Change the prompt word to: traditional village, thatched roofs, mountains

Change the prompt word to: A photo-realistic rendering of a busy market, ((street vendors, fruits, vegetable, shops)), (Photorealistic:1.3), (Highly detailed:1.2), (Natural light:1.2), art inspired by Architectural Digest, Vogue Living, and Elle Decor

I hope this article can help you create your own personalized QR code. If you have any questions, feel free to ask in the comments section.

--

--