Hi Vinicius,
I did it once. I am on Linux so it is straightforward to install
imagemagick, qrencode, potrace and idn. These are used to create an
EPS-file to include in the markup. If you on a different OS with other
tools to create the EPS then you have to adjust the commands.
The base idea is to trigger creation of an EPS, include that as an
EPS-stencil and then (optionally) remove the temporary EPS-file.
HTH
Jan-Peter
Am 16.05.2018 um 07:55 schrieb Vinicius Mascarenhas:
Hi everybody,
I’m making a huge manual for my group with dozens of pages full of QR codes
pointing to examples on YouTube and whatnot. For the time being I’m inserting
them via \epsfile, but then I have to generate, properly name and organize each
one beforehand. It takes much longer than actually finding the links I need.
Is there by any chance a command or function to generate a code by directly
pasting the link as a parameter?
Thanks in advance,
Vinicius
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
\version "2.19.80"
#(define-markup-command (qr-code layout props str size idn)(string? number? boolean?)
"create QR-Code markup from <str> with width <size>. Use IDN for international domain names.
It needs qrencode, imagemagick convert, potrace and optionally idn commands installed in PATH."
(let ((tmp (format "~A-~2A.eps" (strftime "%Y%m%d%H%M%S" (localtime (current-time))) (random 100)))
(qr-stencil (interpret-markup layout props (markup #:with-color red #:filled-box (cons 0 size) (cons 0 size) 0.7)))
(quali (chain-assoc-get 'qr-quality props "L")))
(if (symbol? str)(let ((tmp (chain-assoc-get str props #f)))
(if tmp (set! str tmp))))
(system (format (if idn
"echo \"~A\" | idn --quiet | qrencode -o - -m 0 -l ~A | convert PNG:- BMP:- | potrace -a -1 -o \"~A\""
"echo \"~A\" | qrencode -o - -m 0 -l ~A | convert PNG:- BMP:- | potrace -a -1 -o \"~A\"")
str quali tmp))
(set! qr-stencil (eps-file->stencil X size tmp))
(system (format "rm -v \"~A\"" tmp))
qr-stencil
))
\markup { \qr-code #"https://www.lilypond.org/" #50 ##f }
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user