mnooner256 / pyqrcode

Python 3 module to generate QR Codes
BSD 3-Clause "New" or "Revised" License
408 stars 74 forks source link

How to reduce the padding on generated images ? #54

Open selimb86 opened 7 years ago

selimb86 commented 7 years ago

Hello,

Is is possible to reduce/remove the padding on generated images ?

Thanks.

mnooner256 commented 7 years ago

I am assuming you are referring to the "quiet zone" that surrounds the the QR Code. According to the standard that zone is supposed to 4 modules in size. I often find that size to be excessive, especially at larger scales.

The renderers have a parameter called "quiet_zone" that that lets you set that value.

four_module_border = qrcode.create('Some value").png('Some file', scale=5)
no_border = qrcode.create('Some value").png('Some file', scale=5, quiet_zone=0)

I hope the that helps.

Documentation for png (all renderers have the same parameter)

mfrasca commented 6 years ago

who can close this solved issue?

leandroxbr commented 4 years ago

Still works like a charm! Thanks @mnooner256 :)