Categorygithub.com/pzxy/compress
modulepackage
0.0.0-20240928023817-0435f0b75fe8
Repository: https://github.com/pzxy/compress.git
Documentation: pkg.go.dev

# README

compress

Compress the image to the specified size using a dichotomy

how to use?

go get github.com/pzxy/compress

examples

b, err := os.ReadFile("img.jpg")
if err != nil {
    t.Fatal(err)
}
b, err = compress.CompressImage(b, 0, 100, 200, 10)
if err != nil {
    t.Fatal(err)
}
_ = os.WriteFile("img2.jpg", b, 0644)

# Functions

CompressImage With the minimum width minWidth as the primary constraint, the file size may exceed maxKB.