20
Views
1
Comments
Solved
[ZXing Services] QR code generates with white border around it
Question
zxing-services
Service icon
Forge asset by André Vieira
Application Type
Service

Hi, 


We have been using this asset to generate QR codes, and sometimes multiple of them are displayed below each other. However we found out that some QR codes have white borders around them. Is there any way to remove them?

Kind regards,

Bas

2023-12-07 07-51-40
Remco Dekkinga
 
MVP
Solution

Hi Bas,

Based on the amount of data, the QR code needs more or less black & white squares to generate the code.

As input, we have the width, height, and margin in pixels. 

  1. The Margin will add a fixed white-space around the QR code.
  2. The width and height make sure that the image will have that exact size.

The problem you're facing, is that the width and height in pixels are not fitting the number of black & white squares needed to generate the code and the system uses whitespace to match the requested image size.

On the GitHub page of the library, this issue is also known via issue #570 (https://github.com/micjahn/ZXing.Net/issues/570) and it has a work-around.

When you underdefine the size of the QR-code, it will enlarge the image to fit the minimum QR Code. You can then resize the picture with another Forge component to make it the exact size that you need.
I hope that this helps until the issue is also solved on the Github Library.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.