Created
February 28, 2024 09:10
-
-
Save culttm/283700ae6aa2c955b6446862bd18a4e1 to your computer and use it in GitHub Desktop.
zbarimg.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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