White margin size

30 views
Skip to first unread message

Friso Vrolijken

unread,
Jan 17, 2017, 4:05:19 AM1/17/17
to zxing
Hi all,

If you look at these two images:

https://zxing.org/w/chart?cht=qr&chs=365x365&chld=L&choe=UTF-8&chl=1234567890%0A1234567890%0A1234567890
https://zxing.org/w/chart?cht=qr&chs=335x335&chld=L&choe=UTF-8&chl=1234567890%0A1234567890%0A1234567890

which have all the same settings, other than size. You'll notice the difference in the white border. With regards to that I've got two questions:
- Is there any way to predict how large that will be?
- With a given error correction level, a certain part of the QR code may be unreadable. Do I need to take a percentage of the surface of the entire image or do I need to take a percentage of the image minus the white border?

Groeten,

Friso

Lachezar Dobrev

unread,
Jan 17, 2017, 4:21:39 AM1/17/17
to Friso Vrolijken, zxing
When performing scaling operations ZXing will choose the largest
available INTEGER scaling coefficient that makes the actual code
smaller than the requested size. Your QR Code is 37x37 including the
mandatory quiet zone, so any scaling is done based on that size. You
can see the difference in 369x369 and then 370x370.
Generally speaking most (if not all) forms or Bar-Codes and 2D
Matrices are very sensitive to variations in line width and pixel
sizes. Scaling with a non-integer factor will either scale different
pixels differently, or will insert greyed/blurred areas, which both
would result in harder reading.

If you insist on scaling with a fractional size may I suggest that
you generate your codes with 1x1 request size, which will give you the
smallest possible size of the matrix, and then you can apply whatever
scaling method you desire.
> --
> You received this message because you are subscribed to the Google Groups "zxing" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

friso.v...@gmail.com

unread,
Jan 17, 2017, 8:42:58 AM1/17/17
to Lachezar Dobrev, zxing

Thanks for this reply. I’m not insisting on fractional size, I’m just wondering how it works. If I understand correctly: when I use a 369*369 picture, the amount of error that is allowed is 9*37*37*0.07 (for error level “L”)?

 

Groeten,

Friso

Lachezar Dobrev

unread,
Jan 17, 2017, 9:37:28 AM1/17/17
to Friso Vrolijken, zxing
Well your code (at level L) fits into a 37x37 (V3 is 29x29 data + 4
modules quiet zone on all 4 sides = 37x37) matrix, which is scaled
with the nearest integer scaling factor, which in 369x369 will be 9
(37x9 <= 369), which means that the QR Code will be scaled up to
333x333, and the extra space (13 pixels on all 4 sides) will be left
white.

Scaling does not (normally) increase resilience to defects. Error
correction in level L can restore up to 7% of the data modules. This
does not necessarily translate to 7% of the image. One should take
into consideration, that damage to the positional, timing and
alignment markers and the meta data zones can render an otherwise
undamaged code completely unreadable. On the other hand partial damage
to all modules (like when scanning a document printed with close, but
different DPI setting) can still result in a readable code.

Are you planning on damaging the code intentionally? Like the
'artistic' codes?

Lachezar Dobrev

unread,
Jan 17, 2017, 9:39:17 AM1/17/17
to Friso Vrolijken, zxing
I erred in my calculations: the extra white space is 18, not 13 pixels.

friso.v...@gmail.com

unread,
Jan 17, 2017, 4:16:55 PM1/17/17
to Lachezar Dobrev, zxing

Thanks again, this helps! Yes, the idea is to place a logo in the center. There will be much more data than my example (and not always the same amount of data), so I’m trying to make sure the QR is still readable (with a little extra margin). The image will be shown on a screen so real damage will be low.

 

Groeten,

Friso

 

Van: Lachezar Dobrev
Verzonden: dinsdag 17 januari 2017 15:37
Aan: Friso Vrolijken
CC: zxing
Onderwerp: Re: [zxing] White margin size

 

  Well your code (at level L) fits into a 37x37 (V3 is 29x29 data + 4

Reply all
Reply to author
Forward
0 new messages