Create your own QR code with a logo or image in the middle

You might have seen logos in the middle of QR codes. It was rare to begin with, but has become quite regular nowadays. But how can you create such a logo QR code? Some websites offer this as a paid option. But if you know some programming, you could do it yourself all-in-one. There is a Python library called qrcode that can do this:

I used a command line tool qrencode to create the QR code. Then Inkscape to prepare the white border and background around and behind a transparent logo. Last I used the two ImageMagick tools convert and composite to resize the logo and combind the two into one new image.

Prepare the logo with white border in Gimp or Inkscape

Create a large QR code based on some text or an url, with high error correction

qrencode -o url.png -s 15 -l H ""

I chose -s 15 here to make the QR code large enough and -l H for high error correction. I had to experiment a bit with the size of the logo to have it as large as possible and still be able to scan the QR code.

Resize the logo file to be around a nineth of the QR code

convert -resize 200x200 logo.png logo-200px.png

I chose 200px as this fitted around a nineth of the QR code.

Place the logo in the center of the QR code and save as a new file

composite -gravity center logo-220px.png url.png qr-code-logo.png

The result works fine.

If you are curious about what this was for, and recognized the scout symbol, I was preparing an outdoor geocaching activity for the local scout groups. I hid three different caches and used the QR codes to let them open the coordinates using their mobile phones in Google Maps.