mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-14 12:38:50 +02:00
23 lines
397 B
Go
23 lines
397 B
Go
package webp
|
|
|
|
import (
|
|
"github.com/belphemur/go-webpbin"
|
|
"image"
|
|
"io"
|
|
)
|
|
|
|
const libwebpVersion = "1.4.0"
|
|
|
|
func PrepareEncoder() error {
|
|
webpbin.SetLibVersion(libwebpVersion)
|
|
container := webpbin.NewCWebP()
|
|
return container.BinWrapper.Run()
|
|
}
|
|
func Encode(w io.Writer, m image.Image, quality uint) error {
|
|
return webpbin.NewCWebP().
|
|
Quality(quality).
|
|
InputImage(m).
|
|
Output(w).
|
|
Run()
|
|
}
|