Local Barcode for Blender

This addon allows you to create various barcodes as meshes. It currently supports QR, MicroQR, PDF417, and Aztec codes.

This project now has a github. Feel free to contribute if you feel like it.

Downloads

This addon started life as the Local QR Code addon by Jacob Welsh. I previously updated it to work with blender 2.8, and have since greatly expanded it. Since it now supports more than just QR codes, I have renamed it to Local Barcodes.

This is my first real addon, and my first foray into BPY and python beyond just updating old addons. The code is probably messy, and I’m sure there will be bugs. Let me know if you run into any problems.

These currently only work in Object Mode. They might half work in edit mode, but if they do, it’s unintended.

Summary of the barcodes:

QR Codes

QR codes are most commonly used for marketing. They are also sometimes used in electronics or manufacturing as machine readable product numbers. They will often contain a URL, although they can hold any text or numbers. They can hold many common symbols. Technically, they can hold kanji as well, but I could not get it working. If you can get Blender to take kanji as a text input, it should automatically switch to kanji encoding mode. If it doesn’t, please let me know.

QR codes can have error correction. This means they can still be read after being damaged, at the cost of a larger code. Higher EC level, bigger code, more damage tolerance, up to 30%.
At max size, and with lowest EC level, they can theoretically store up to 4,296 alphanumeric characters. Bear in mind that large codes are VERY hard to scan with phone cameras.

MicroQR Codes

MicroQR codes are smaller versions of QR codes. They have a higher information density, but a much smaller top size. Big warning: they are VERY rare, and I do not believe a single Android app can read them. Apparently, the i-nigma app for apple devices can read them, but I can’t test this. If you find an Android app that can scan these, let me know.

Aztec Codes

Aztec codes are commonly used on boarding passes, and medical labeling and equipment. They can be read inverted and mirrored and require no quiet space around them. They are less common than QR codes, and the scanner app support for them is a little rarer and less reliable. They have error Correction support, but I could not figure out how to control this in the generator library. I believe the generated codes have some, but I do not know how much.

PDF417 Codes

PDF417 codes are commonly used for logistics, document management, and ID cards and systems. If you have a US Drivers license, there is probably one on it. They can have a very high data density. PDF417s can theoretically hold up to 1850 alphanumeric characters, but in practice, due to encoding differences, it will be lower. They support multiple levels of Error Correction. These are more difficult than the others here to read with a cellphone camera, so if that is the goal, try to keep it fairly small.

While this addon does not yet support 1D barcodes, I can recommend the 3 of 9 font. It is a code 39 barcode. If using it, remember to start and end the text with * symbols, as they are used as beginning and end markers.

I personally use these barcodes with Decal Machine to turn them into decals, but as they are meshes, you can do whatever you want with them.

The reasoning behind the “Local” in the title is that this addon uses no online services to generate barcodes. It generates them entirely locally using a few different open source libraries.
The libraries used and liscenses are:

The most reliable Android apps I have found for scanning the less common barcode types are Scan Them All - 2D & Barcodes and Neo Reader.

Future plans:

  • Datamatrix codes
  • 1D codes
  • any other 2D barcodes. If you can find a pure python library that generates a 2D barcode that I don’t have here, I will happily give them a look over to see if I can implement it.
5 Likes

Nice work man! A while ago I already used your updated 2.80 version of Jacob Welsh’s add-on to create my QR-codes, among others for my twitter, so I really appreciate what you do here. Thanks a lot and I’ll certainly check out your new add-on.

As apps are concerned, I can recommend having a look at the f-droid repository, everything there’s FOSS and privacy-minded. There’s quite a selection although I personally use ZXing’s Barcode Scanner. (not affiliated)
https://search.f-droid.org/?q=qr&lang=en

Oh, quick question, do I need to de-install the old (i.e. Jacob’s) add-on for your new one to work?

1 Like

Hey that’s pretty cool. I use qrencode(for terminal) occasionally, but having this directly in Blender is super cool indeed. Thanks for the mention of DM too!

Is this on github somewhere? I may want to tinker with it and add background + FG/BG color support.

1 Like

Hey that’s pretty cool!
Nope, you don’t need to uninstall the old one. They will work perfectly together. I had the old one installed for most of this ones development. I’m pretty sure I covered everything the old one did tho.

1 Like

Man, I use DM 24/7. It’s brilliant.

Nope, as i’m just learning to code, I haven’t learned to use github yet. I’ll see about getting it set up soon.

1 Like

I’ve now set up a github repo for this project. It’s in the main post.

1 Like

Hi, I installed the add-on but when I tried to enable it in the add-on list I got this error message. Any instructions?

Traceback (most recent call last):
File “/usr/local/blender-2.80-linux-glibc217-x86_64/2.80/scripts/modules/addon_utils.py”, line 351, in enable
mod = import(module_name)
File “/home/privacy/.config/blender/2.80/scripts/addons/add_mesh_barcode/init.py”, line 90, in
from . addon import pdf417
File “/home/privacy/.config/blender/2.80/scripts/addons/add_mesh_barcode/addon/pdf417.py”, line 8, in
from … generators.pdf417gen import encode # , render_svg, render_image
File “/home/privacy/.config/blender/2.80/scripts/addons/add_mesh_barcode/generators/pdf417gen/init.py”, line 2, in
from . rendering import render_image, render_svg
File “/home/privacy/.config/blender/2.80/scripts/addons/add_mesh_barcode/generators/pdf417gen/rendering.py”, line 1, in
from PIL import Image, ImageColor, ImageOps
ModuleNotFoundError: No module named ‘PIL’

1 Like

Aah. My bad. I never tested without PIL installed. It is not even used, so this shouldn’t be hard to fix. I’ll see what I can do.

I just updated the plugin. It should fix the problem. Let me know if it doesn’t.

1 Like

Thanks for looking into the matter but I’m afraid there’s still some problem. I installed the add-on from your github but it doesn’t appear in the add-on list, so I could enable it.

AH. I forgot that blender doesn’t like “.” in it’s addon names. I’ll fix this on my end, but to fix it yourself, just replace each “.” in the addon folder name with “_”

1 Like

Worked like a charm. Thnx!

1 Like

this is great! Thanks =)