mirror of
https://github.com/gen2brain/cam2ip.git
synced 2025-12-16 04:18:39 +00:00
Add jpegli
This commit is contained in:
31
image/decode_jpegli.go
Normal file
31
image/decode_jpegli.go
Normal file
@@ -0,0 +1,31 @@
|
||||
//go:build jpegli
|
||||
|
||||
// Package image.
|
||||
package image
|
||||
|
||||
import (
|
||||
"image"
|
||||
"io"
|
||||
|
||||
"github.com/gen2brain/jpegli"
|
||||
)
|
||||
|
||||
// NewDecoder returns a new Decoder.
|
||||
func NewDecoder(r io.Reader) *Decoder {
|
||||
return &Decoder{r}
|
||||
}
|
||||
|
||||
// Decoder struct.
|
||||
type Decoder struct {
|
||||
r io.Reader
|
||||
}
|
||||
|
||||
// Decode decodes image from JPEG.
|
||||
func (d Decoder) Decode() (image.Image, error) {
|
||||
return jpegli.DecodeWithOptions(d.r, &jpegli.DecodingOptions{
|
||||
DCTMethod: jpegli.DCTIFast,
|
||||
FancyUpsampling: false,
|
||||
BlockSmoothing: false,
|
||||
ArithCode: true,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user