Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Latest commit

 

History

History
22 lines (18 loc) · 349 Bytes

README.md

File metadata and controls

22 lines (18 loc) · 349 Bytes

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)