Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QR Code generation in shell / mac terminal

Tags:

I want to create QR codes for a project I'm working on in applescript the resulting qr will be placed in the indesign document. I have found that there is a plugin for indesign but I suspect that requires user interaction.

So I've been search for how to generate the qr using a shell command. I've found things related to php and rails and even coldfusion but none of those will fit the bill on this. I need to generate them using shell command so image events or perl basically anything I can run from the command line that comes with the mac os

thanks for your help.

antotheer

I wonder if I could call a url using curl or somthing to get one ?

like image 994
mcgrailm Avatar asked Jun 02 '11 13:06

mcgrailm


2 Answers

For doing something similar, we use libqrencode.

It's a c library for generating QR codes, but it comes with a command line utility (called qrencode) which lets you generate QR codes from a string, e.g.:

./qrencode -o /tmp/foo.png "This is the input string"

It supports most options you'd probably want (e.g. error correction level, image size, etc.).

We've used it in production for a year or two, with no problems.

I've only run it on linux systems, but there's no reason you shouldn't be able to compile it on Mac OS, assuming you have a compiler and build tools installed (and any libraries it depends on of course).

like image 191
Dave Challis Avatar answered Sep 20 '22 07:09

Dave Challis


As Riccardo Cossu mentioned please use homebrew:

brew install qrencode
qrencode -o so.png "http://stackoverflow.com"
like image 31
0x8BADF00D Avatar answered Sep 20 '22 07:09

0x8BADF00D