DiffQRCoder: Diffusion-Based Aesthetic QR Code Generation with Scanning Robustness Guided Iterative Refinement

Jia-Wei Liao, Winston Wang, Tzu-Sian Wang, Li-Xuan Peng, Ju-Hsuan Weng, Cheng-Fu Chou, Jun-Cheng Chen

Abstract

DiffQRCoder is a training-free, two-stage diffusion method that generates "aesthetic" QR codes—artistic images that function as fully scannable codes. By introducing a novel guidance mechanism and a latent-space refinement step, the authors achieve a near-perfect 99% scanning success rate without sacrificing the visual beauty of the generated art.

Introduction

Quick Response (QR) codes are ubiquitous but aesthetically dull. While researchers have tried to "beautify" them by blending them with images or using generative AI, they face a stubborn "scannability-vs-beauty" trade-off. If you prioritize the art, the QR scanner fails because the underlying data modules (the little black and white squares) are too distorted. If you prioritize scannability, the resulting image often looks like a cluttered mess of pixels. Current diffusion-based tools like ControlNet struggle with stability; users often have to manually "cherry-pick" or post-process images to find one that actually works. DiffQRCoder aims to automate this process, ensuring that every beautiful code is also a functional one.

An aesthetic QR code generated by DiffQRCoder featuring an anime-style character and cherry blossoms.

Methods

The authors propose a two-stage pipeline that requires no additional training of the underlying models:

  1. Stage 1: Initial Generation. The system uses a standard pre-trained ControlNet to generate an "aesthetic but likely unscannable" QR code based on a text prompt.
  2. Stage 2: Iterative Refinement. The image is refined using Scanning-Robust Perceptual Guidance (SRPG). This guidance combines two losses:
  3. Scanning Robust Loss (SRL): This evaluates the image at the "module" level. Since QR scanners care most about the center of each module, SRL uses a Gaussian kernel to prioritize those center pixels. It also features an early-stopping mechanism: once a specific module is deemed "scannable," the algorithm stops modifying it, preserving as much of the original art as possible.
  4. Perceptual Loss (LPIPS): This ensures the image stays visually similar to the "pretty" version from Stage 1.

Finally, they introduce Scanning Robust Manifold Projected Gradient Descent (SR-MPGD). This is a post-processing step that performs optimization within the latent space of a Variational Autoencoder (VAE). It nudges the image toward 100% scannability while ensuring it stays on the "natural image manifold"—essentially keeping the image looking like a coherent piece of art rather than a corrupted file.

Key Results

DiffQRCoder achieved a 99% Scanning Success Rate (SSR), a massive jump from the 60% achieved by using standard ControlNet alone. In subjective user studies, DiffQRCoder was ranked as the leading method for balancing attractiveness with functionality. It maintained a high CLIP-aesthetic score (6.82), nearly matching methods that produce beautiful but unscannable images.

Comparison between the baseline QRBTF and the proposed DiffQRCoder, showing improved scannability patterns.

The codes remained scannable even under difficult conditions, such as a 45-degree tilt (97% SSR) and the most rigorous QR error-correction settings. The process is efficient, taking roughly 14–18 seconds on a single NVIDIA RTX 4090.

Conclusion

DiffQRCoder successfully bridges the gap between QR code functionality and artistic expression. By focusing on the critical center of QR modules and optimizing within the latent space, it provides a robust solution for generating high-quality aesthetic QR codes. Future work could explore even more sophisticated ways to hide data within high-frequency image details to further minimize the aesthetic trade-off.

Summary updated

BibTeX
@inproceedings{liao2025diffqrcoder,
  author = {Jia-Wei Liao and Winston Wang and Tzu-Sian Wang and Li-Xuan Peng and Ju-Hsuan Weng and Cheng-Fu Chou and Jun-Cheng Chen},
  title = {{DiffQRCoder: Diffusion-Based Aesthetic QR Code Generation with Scanning Robustness Guided Iterative Refinement}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2025},
  doi = {10.1109/wacv61041.2025.00577},
}
Figure