QR codes can also be creative: In-depth analysis of the production process of AI QR codes

QR codes can also be creative: In-depth analysis of the production process of AI QR codes

Hayo News
Hayo News
July 19th, 2023
View OriginalTranslated by Google
Do you want to have the same style of the recently popular artistic QR code effect? ​​This tutorial will show you in detail how to use Stable Diffusion to generate an artistic QR code like this~!

QR code principle

The principle of the two-dimensional code can be roughly understood according to the figure below. After identifying the positioning point, analyze the information inside. The more information it contains, the denser the points in the two-dimensional code

When scanning the QR code, the information in the QR code will be interpreted after identifying the positioning point

Handle QR codes

-1. First we install the QR Toolkit plugin in SD


Come to the extension interface, copy the address above and click to install from the URL.

-2. A QR code that is easy to integrate with pictures is the foundation. There are two directions to consider in the pre-processing of the QR code, namely changing the style of the anchor point and making the QR code more concise.

First, change the anchor point style, so that the generated QR code will not have an obvious anchor point frame, but correspondingly, the recognizability rate will also decrease, and a balance needs to be found between the two and the parameters

In QR Toolkit, you can find different styles for different types of points, and you can try different collocation combinations. Different collocation combinations have a great impact on the generated image, including the image content and recognition rate. Different prompt words will also be different. There are different screen performances on the QR code of the style, and multiple attempts are required

Secondly, the QR code information should be as little as possible, the simpler the pattern, and the generated QR code will be easier to scan. In the QR Toolkit, the fault tolerance of the QR code can be set, from left to right are 7%, 15% %, 25%, 30%, we need to ensure a higher fault tolerance rate, but a higher fault tolerance rate also corresponds to a more complex image, generally recommend 25% and 30%, the tutorial uses 25% (Q) as an example

Configure ControlNet

Next comes controlnet, we need to download two unofficial controlnet models: QR Code Monster v1.0 and Brightness, download in the link below

https://huggingface.co/monster-labs/control_v1p_sd15_qrcode_monster/tree/main ,


Brightness is a controlnet similar to depth, and it also includes a controlnet for the purpose of controlling the light and shadow composition from 0 to 1 stage. QR Code Monster controls pictures more like a QR code

Load the two models in the two controlnet channels respectively, select none for the preprocessor,

The control weight represents the intensity of controlnet intervention. The recommended parameters are QR Code Monster: >1.2, Brightness between 0.2~0.4. The greater the intensity and the intervention interval, the greater the light and dark contrast of the final image. The QR code and The image fusion is also worse, more like a QR code.

The boot intervention/termination timing controls the range of steps in which controlnet takes effect. It is recommended to let the AI ​​play freely at the end. The larger the adjustment of the intervention interval, the final picture will be more like a QR code and easier to scan. The smaller the value, the fusion of the prompt word and the QR code The higher the degree, the lower the corresponding scanning success rate.

The data is not absolute, the parameters in the tutorial are not the optimal solution, and it still takes a lot of trials to get a relatively good result.

generate image

Models, prompts, sampling steps, and samplers can all be adjusted according to your preferences. The tutorial also gives the parameters of the example diagrams for reference

Model: breakdomain_M2150

Steps: 30

Sampler: Euler a

CFG scale: 8

Among them, you can write some prompt words that are easier to integrate with QR codes, such as ribbons, forests, waves, and flowers. The number of sampling steps can be set higher, and the effect of high-definition restoration will be better. It is recommended that the final generated image pixels be greater than 1000

Finally, continuous experimentation is a necessary condition to obtain an easy-to-scan, high-integration, and beautiful QR code. Therefore, try to get started and have your own QR code~


no dataCoffee time! Feel free to comment