Skip to content

Instantly share code, notes, and snippets.

@culttm
Created February 28, 2024 09:10
Show Gist options
  • Save culttm/283700ae6aa2c955b6446862bd18a4e1 to your computer and use it in GitHub Desktop.
Save culttm/283700ae6aa2c955b6446862bd18a4e1 to your computer and use it in GitHub Desktop.
zbarimg.go
package main
import (
"fmt"
"log/slog"
"os/exec"
)
func main() {
imagePath := "metro_scan.jpg"
cmd := exec.Command("zbarimg", "--raw", imagePath)
output, err := cmd.CombinedOutput()
if err != nil {
slog.Error(err.Error())
return
}
fmt.Println(string(output))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment