mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-14 04:28:51 +02:00
feat: revert to use webp executable
This commit is contained in:
@@ -2,8 +2,8 @@ package converter
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/belphemur/CBZOptimizer/v2/internal/manga"
|
||||
"github.com/belphemur/CBZOptimizer/v2/internal/utils/errs"
|
||||
"github.com/belphemur/CBZOptimizer/v2/manga"
|
||||
"github.com/belphemur/CBZOptimizer/v2/pkg/converter/constant"
|
||||
"golang.org/x/exp/slices"
|
||||
"image"
|
||||
|
@@ -1,19 +1,22 @@
|
||||
package webp
|
||||
|
||||
import (
|
||||
"github.com/kolesa-team/go-webp/encoder"
|
||||
"github.com/kolesa-team/go-webp/webp"
|
||||
"github.com/belphemur/go-webpbin/v2"
|
||||
"image"
|
||||
"io"
|
||||
)
|
||||
|
||||
const libwebpVersion = "1.5.0"
|
||||
|
||||
func PrepareEncoder() error {
|
||||
return nil
|
||||
webpbin.SetLibVersion(libwebpVersion)
|
||||
container := webpbin.NewCWebP()
|
||||
return container.BinWrapper.Run()
|
||||
}
|
||||
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)
|
||||
return webpbin.NewCWebP().
|
||||
Quality(quality).
|
||||
InputImage(m).
|
||||
Output(w).
|
||||
Run()
|
||||
}
|
||||
|
Reference in New Issue
Block a user