Giter VIP home page Giter VIP logo

qrcode-artistic's Introduction

Artistic QR Codes

This Segno plugin converts a (Micro) QR Code to a Pillow Image or into a QR code with a background image.

This plugin is not required to write PNG, EPS or PDF files. Segno's native implementations usually generate smaller files in less time.

This plugin might be useful to modify the QR Codes (i.e. rotate or blur) or to save the QR codes in an image format which is not supported by Segno.

Furthermore, QR codes can be created with a background image.

image

image

Transparency is supported as well

image

Use pip to install from PyPI:

$ pip install qrcode-artistic

Documentation: https://segno.readthedocs.io/en/latest/artistic-qrcodes.html

qrcode-artistic's People

Contributors

gopackgo90 avatar heuer avatar ubertao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

qrcode-artistic's Issues

Using large scale with qrcode_artistic results in blurry QR image

Hello,

When I create a QR code pointing to https://en.wikipedia.org/wiki/Main_Page with the scale set to 35 and with an image background using qrcode_artistic, the resulting QR image is very blurry even if the provided image is large.
If I use segno alone to create a simple QR, the resulting image is crisp.

This is the code:

image = 'firefoxLogo.png' qr = segno.make('https://en.wikipedia.org/wiki/Main_Page', micro=False) qrSimple = qr.save('outSimple.png', scale=35, border=1) qrArtistic = qr.to_artistic(background=image, border=1, target='outArtistic.png', scale=35)

Simple QR:
outSimple

Artistic QR
outArtistic

And the logo file I have used:
firefoxLogo

Trimming the outer margin of qr codes

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

apparent infinite loop with scale=float

Hi! I think there's an infinite loop in to_artistic() when scale is a float. Example:

>>> qr.to_artistic(background='whatever.png', target='qr.png', scale=4.5)
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../.direnv/python-3.10.4/lib/python3.10/site-packages/qrcode_artistic.py", line 134, in write_artistic
    while scale % 3:
KeyboardInterrupt

I'm using qrcode-artistic==2.1.0, segno==1.5.2

I think this is happening here:
https://github.com/heuer/qrcode-artistic/blob/b93c548/qrcode_artistic.py#L140-L141

as you can see, this loops forever with any non-integer

>>> x = 4.5
>>> for i in range(20):
...  print(x % 3)
...  x += 1
... 
1.5
2.5
0.5
1.5
2.5
0.5

is it reasonable to add a check before the loop which crashes if round(scale) != scale? I'm happy to submit this PR if that's useful to you.

thanks for this library, I love the results

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.