lincolnloop / python-qrcode

Python QR Code image generator
https://pypi.python.org/pypi/qrcode
Other
4.34k stars 664 forks source link

PNG generated from CLI is corrupt #220

Closed mikepianka closed 3 years ago

mikepianka commented 3 years ago

I'm finding that the PNG generated from the command line tool is corrupt, but the PNG generated from Python is fine. I'm using version 6.1 on Windows.

This creates a corrupt PNG that Windows Photo Viewer, Paint.NET, IrfanView, etc. can't open: qr "Some text" > test.png

This PNG is fine:

import qrcode
img = qrcode.make('Some data here')
img.save('test2.png')

I found an old closed Issue #92 that seems like it may have been a similar problem?

heuer commented 3 years ago

I cannot confirm the problem, using qrcode 6.1 (six 1.15.0, colorama 0.4.4) and Pillow 8.1.0 with Python 3.9.1 seem to deliver the correct output.

It generates a PNG file about 1kB which is readable by the Windows Photo Viewer.

mikepianka commented 3 years ago

Here's the corrupt output: Example Corrupt Image

I'm using Python 3.8.5 with the same versions except that I have colorama 0.4.3.

appdirs==1.4.4
argcomplete==1.12.1
atomicwrites==1.4.0
beautifulsoup4==4.9.3
black==20.8b1
click==7.1.2
colorama==0.4.3
flake8==3.8.3
iniconfig==1.0.1
lxml==4.6.1
mccabe==0.6.1
mypy-extensions==0.4.3
numpy==1.19.2
packaging==20.4
pathspec==0.8.0
**Pillow==8.1.0**
pipx==0.15.5.1
pluggy==0.13.1
py==1.9.0
pycodestyle==2.6.0
pyflakes==2.2.0
pyparsing==2.4.7
pytest==6.1.0
**qrcode==6.1**
regex==2020.9.27
**six==1.15.0**
soupsieve==2.0.1
toml==0.10.1
typed-ast==1.4.1
typing-extensions==3.7.4.3
userpath==1.4.1
heuer commented 3 years ago

I tried it with Python 3.8.7 and I get still a valid image (Windows 10.0.18363)

test

Sorry for not being able to help.

mikepianka commented 3 years ago

I didn't come to a conclusion and just ended up running the tool through python for my purposes.