heuer/qrcode-artistic

Trimming the outer margin of qr codes

sinazadeh opened this issue · 3 comments

There is a white space outside of QR codes. Although it is possible to trim it using other libraries, I think it would be great to have this option in this library.
Before:
yellow-submarine1
After:
yellow-submarine1 - Copy

Or add the option to the output files of the Sengo library. I don't know which one is more possible.

heuer commented

It's already possible. Segno and this plugin supports a "border" keyword. If set to zero, the border / quiet zone is omitted:

>>> import segno
>>> qr = segno.make('Yellow Submarine')
>>> qr.save('yellow-submarine-border-zero.png', scale=4, border=0, dark='darkred', data_dark='darkorange', data_light='yellow')

yellow-submarine-border-zero

>>> qr = segno.make('Yellow Submarine', version=7)
>>> qr.save('yellow-submarine7-border-zero.png', scale=4, border=0, dark='darkred', data_dark='darkorange', data_light='yellow')

yellow-submarine7-border-zero

The different parameters are also mentioned in the docs: https://segno.readthedocs.io/en/latest/serializers.html

heuer commented

Example using this plugin:

>>> import segno
>>> qr = segno.make('Yellow Submarine', version=7)
>>> pil_img = qr.to_pil(scale=4, border=0, dark='darkred', data_dark='darkorange', data_light='yellow')
>>> pil_img.save('yellow-submarine-pil.png')

The result should be the same as above