Menu

Tree [390878] main /
 History

HTTPS access


File Date Author Commit
 qrcode-backgrounds 2022-11-18 Bill Hoppy Bill Hoppy [7f2ae3] initial
 qrcode-preppernet 2022-11-18 Bill Hoppy Bill Hoppy [390878] add qrcode-preppernet
 README.md 2022-11-18 Bill Hoppy Bill Hoppy [6928f3] update readme
 qrcode-email-hello.py 2022-11-18 Bill Hoppy Bill Hoppy [7f2ae3] initial
 qrcode-url-preppernet-com.py 2022-11-18 Bill Hoppy Bill Hoppy [7f2ae3] initial
 qrcode-url-preppernet-net.py 2022-11-18 Bill Hoppy Bill Hoppy [7f2ae3] initial
 qrcode-vcard-myvcard.py 2022-11-18 Bill Hoppy Bill Hoppy [7f2ae3] initial

Read Me

QRcode Python Segno

The following creates QRCodes using a program scripting language called python. Python can be installed on many operating systems see https://www.python.org/ on how to install.

Why not just use one of the many free QRCode create sites on the web? They are free for a reason to harvest data.

Note: if you a Mac or Raspberry PI it might already be installed.

Note: This is a command line tool which will require access to a shell terminal.

Install Python3

Verify that python is installed

python3 --version

You should have output like below. If not go to https://www.python.org/ on how to install.

Python 3.10.6

Install pip3

Python package manager named pip3 will need to be installed to download the segno module.

Verify that pip3 is installed.

pip3 --version

You should have out like below. If not got to https://pip.pypa.io/en/stable/installation/ on how to install.

pip 22.0.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)

Install Segno

Check if segno python library is installed.

pip3 list 

Look through the list to find segno.

segno              1.5.2

If not installed run the following command to install.

pip3 install segno

Once installed verify the command.

segno -V
Segno 1.5.2

Creating QRCodes

The command line tool can create QRCodes using command line.

NOTE: The image will be saved into your current directory. Change into the directory you want to store your QRCode if required.

NOTE: The image is an PNG file (Portable Network Graphic) and opens in a lot of viewers including web browsers.

Examples:

URL

This will create the file named qrcode-url-usdebtclock-org.png in your current working directory.

segno --scale=4  "https://www.usdebtclock.org/" --output=qrcode-url-usdebtclock-org.png

NOTE: if you want to have a backgroup image see URL with Background Image below.

URL File Share

Example of link to a file.

segno --scale=4  "https://drive.google.com/file/d/19R3v4XXn1tLmKLI1Os1oFq1ZM9dVqNS8/view?usp=sharing" --output=url-prepyourgarden.png

V-CARDS

VCards are a little harder and requires a script to created.

Create a script named qrcode-vcard-myvcard.py

Edit the script below replacing your information.

import segno
from segno import helpers

qrcode = helpers.make_vcard(name='LastName;FirstName', displayname='FirstName LastName',                           
        email=('my@email.com', 'anotheremail@myemail.com'),
        phone='+1 555 555 1111')
qrcode.save('qrcode-vcard-myvcard.png', scale=4)

Run this command to create the QRCode.

python3 qrcode-vcard-myvcard.py

A file named qrcode-vcard-myvcard.png is created in your current working directory.

Emails

Create a file qrcode-email-hello.py

import segno
from segno import helpers

qrcode = helpers.make_email(to='my@email.com', cc=None,bcc=None,subject='Hello',body='Thanks')
qrcode.save('qrcode-email-hello.png', scale=4)
python3 qrcode-email-hello.py

URL with Background Image

To create script file below named qrcode-url-preppernet-net-logo.py

Download the logo image place in in you current working directory which in this example is named logo-image-200x261.png.

import segno

qrcode = segno.make('https://www.preppernet.net')
qrcode.save('qrcode-url-preppernet-net.png', scale=6)
qrcode.to_artistic(background='logo-image-200x261.png', target='qrcode-url-preppernet-net-logo.png', scale=6)
python3 qrcode-url-preppernet-net-logo.py
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.