< Billy Overton >

Programmer / Technology Consultant

QR Simplicity

Posted 2011-12-24 | Billy Overton

For one reason or another, I found myself in need of a large number of QR codes. Normally I manually use the site http://qrcode.kaywa.com/ when I need one or two, but that just wasn’t practical in this case. On the other hand, I really didn’t want to go about finding out how to generate the images on my own, so I whipped up this dead simple bash script:

while read line; do
  curl "http://qrcode.kaywa.com/img.php" -s --get -d s=8 \\
      --data-urlencode d="$line" -o $i.png
  i=$(( $i + 1 ))
done < "$1"

It simply takes each line from a text file and uses curl and the kaywa website to generate the png file. Since I wasn’t too concerned about the file name, I just used a counter variable. It isn’t clean or terribly useful, but it got the job done.