[scribus] Script to generate QR-codes?

Gregory Pittman gpittman at iglou.com
Wed Apr 23 16:30:48 UTC 2014


On 04/23/2014 03:55 AM, Terry Burton wrote:
> On 22 April 2014 17:50, Gregory Pittman <gpittman at iglou.com> wrote:
>> On 04/22/2014 12:14 PM, Tornóci László wrote:
>>> Hi,
>>>
>>> I use scribus 1.4.3 on Fedora 20, and I am quite happy with it. I'm
>>> working on an ECG textbook with lots of QR codes in it. (The idea is the
>>> readers use their tablet to read the QR code and get to a companion
>>> website if they need to look up a term or want to learn more about
>>> something). I can generate any QR-code I want (Insert | Barcode), but it
>>> is a bit tedious (I need to change the default URL and color). I guess
>>> there's a way to write a script that offers a default URL lets me edit
>>> it, sets the color and produces the QR code. Problem is, I don't know
>>> Python and scribus scripting except they exist. Perhaps a good soul can
>>> help me with this...
>>>
>>
>> Currently there is no scripter command to create QR codes.
> <...snip...>
>> Once Scripter 2 is working we may be able to add a QR code command.
> 
> To satisfy the general case I've added "Allow the barcode plugin to be
> driven from ScripterNG" to
> http://wiki.scribus.net/canvas/Barcode_Plugin_Development
> 

It also might be worth seeing if there might be a behavior/data
persistence during a session with Scribus. For example, if the last time
I used the generator it was for QR Codes and used a particular entry for
the text, it would make sense to have that as a starting point the next
time I use it. This might satisfy the need the original poster had in mind.

I've begun looking at qrcode.py and while it seems that yes, one could
figure out a script in Scribus to make use of this, you would need some
recursive ability to satisfy the workflow desire of the original post.

What I can envision might be useful, helpful, and give some
functionality outside of what Barcode Generator has to offer would be
making use of the command 'qr' that is built into qrcode.py.
For example,

qr "http://www.scribus.net" > address.png

makes your QR Code as a PNG file. Of course, with dozens of codes, you
are not looking forward to doing this dozens of times (you still have to
import to image frames, though this should be easily scriptable), but I
can easily imagine semi-automatically writing a shell script to make a
large number of patterned QR codes. An additional benefit you get from
this is a future reference that clearly shows which address goes with
which file. Surely you will scan each code with some device, but
hopefully not more than once. The filename might give a clue by itself,
but this has limitations.

Part of the weirdness of QR Codes is their variability. I made a code
with barcode generator using the default 'http://scribus.net', then made
one with the qr command and they didn't look much alike, yet were both
scanned correctly by my phone!

Greg

P.S.

For those using Linux that want to check out qrcode.py, google it,
download the file, then uncompress/extract. Inside the generated
directory, run the command

sudo python setup.py install

and you're done. You should immediately be able to use the qr command.
Documentation exists but is sparse.



More information about the scribus mailing list