Inpiration from Estimating Quality
file, err := os.Open("file.jpg")
if err != nil {
log.Fatal(err)
}
j, err := jpegquality.New(file) // or NewWithBytes([]byte)
if err != nil {
log.Fatal(err)
}
log.Printf("jpeg quality %d", j.Quality())
There is some output to your current log. So, you can change output target with SetDefaultLoggerOutput
before running code from above. E.g., disable logging:
jpegquality.SetDefaultLoggerOutput(ioutil.Discard)
j, err := jpegquality.New(file) // or NewWithBytes([]byte)
...