mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-13 20:18:52 +02:00
20 lines
387 B
Go
20 lines
387 B
Go
package webp
|
|
|
|
import (
|
|
"github.com/kolesa-team/go-webp/encoder"
|
|
"github.com/kolesa-team/go-webp/webp"
|
|
"image"
|
|
"io"
|
|
)
|
|
|
|
func PrepareEncoder() error {
|
|
return nil
|
|
}
|
|
func Encode(w io.Writer, m image.Image, quality uint) error {
|
|
options, err := encoder.NewLossyEncoderOptions(encoder.PresetDefault, float32(quality))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return webp.Encode(w, m, options)
|
|
}
|