A babashka pod for reading and writing QR codes, backed by the Go library gozxing (a port of ZXing).
This pod exists because javax.imageio.ImageIO / AWT do not work in the
babashka native image (GraalVM does not ship the AWT native libraries, see
oracle/graal#10951). The Go pod
does image decoding and QR processing out of process.
(require '[babashka.pods :as pods])
(pods/load-pod 'org.babashka/gozxing "0.0.1")
;; or load a local build:
;; (pods/load-pod "./pod-babashka-gozxing")
(require '[pod.babashka.gozxing :as qr])
;; encode text into a QR png
(qr/encode "https://babashka.org" "out.png")
(qr/encode "https://babashka.org" "out.png" {:size 512})
;; decode a QR from a file path
(qr/decode "out.png") ;;=> "https://babashka.org"
;; decode from raw image bytes
(require '[babashka.fs :as fs])
(qr/decode (fs/read-all-bytes "out.png"))(decode path-or-bytes) - reads a QR code from a PNG/JPEG/GIF file path or raw
image bytes. Returns the decoded text. Throws if no QR code is found.
(encode text path) / (encode text path opts) - writes text as a QR code
PNG to path. Options:
:size- width/height in pixels (default256)
Returns the output path.
script/buildscript/testCopyright © 2026 Michiel Borkent
Distributed under the MIT License. See LICENSE.