Skip to content

Instantly share code, notes, and snippets.

@sigwinch28
Created January 9, 2020 23:38
Show Gist options
  • Save sigwinch28/a63ad6d94fcd806aafa4d486c0be5fcf to your computer and use it in GitHub Desktop.
Save sigwinch28/a63ad6d94fcd806aafa4d486c0be5fcf to your computer and use it in GitHub Desktop.
QR code with label
#!/bin/sh
# Requirements: imagemagick (for `identify` and `convert`) and qrencode
TEXT="$1"
OUT_FILE="$2"
QR_IMG_FILE=$(mktemp --suffix=.png)
qrencode -s 6 -o "$QR_IMG_FILE" "$TEXT"
WIDTH=$(identify -format '%w' "$QR_IMG_FILE")
convert "$QR_IMG_FILE" \( -size "${WIDTH}x" -gravity center label:"$TEXT" \) -append "$OUT_FILE"
rm "$QR_IMG_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment