Input a JPEG file to detect the quality of the image along with the Quanization Table and DQTs.
Inpiration from Estimating Quality.
Fixed bug base on HuangYeWuDeng ttys3/jpegquality.
Golang
In order to install and run this program, please follow the steps below:
git clone https://github.com/liut/jpegquality.git
Follow this [link](https://go.dev/doc/install) for help.
cd jpegq && go build
jpegq [FILENAME]
Example: jpegq myphoto.jpg
1. Fork the main repository
git clone https://github.com/liut/jpegquality.git
Follow this [link](https://go.dev/doc/install) for help.
git checkout -b <name-of-branch>
file, err := os.Open("file.jpg")
if err != nil {
log.Fatal(err)
}
defer file.Close()
j, err := jpegquality.New(file) // or NewWithBytes([]byte)
if err != nil {
log.Fatal(err)
}
log.Printf("jpeg quality %d", j.Quality())
This program's output accurracy was tested thoroughly in jpegquality_tests.go. Feel free to add anymore tests for edge cases!
Please report any bugs below to ensure contributors can keep this code functional and easy to use
go get github.com/liut/jpegquality/cmd/jpegq
jpegq myphoto.jpg
2019/10/03 00:09:08 jpegquality.go:135: Quantization table length 130
2019/10/03 00:09:08 jpegquality.go:144: read bytes 130
2019/10/03 00:09:08 jpegquality.go:161: DQT: table index 0 (luminance), precision: 8
2019/10/03 00:09:08 jpegquality.go:208: tbl 0: 23.90413 572.61780 88.04793
2019/10/03 00:09:08 jpegquality.go:212: aver_quality 88
88
jpegquality.SetLogger(log.New(os.Stderr, "jpegq", log.LstdFlags|log.Lshortfile))