mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
Since AVIF computation was awfully slow, this exposes the CPU effort setting "speed".
This commit is contained in:
parent
2cba482a06
commit
e87ff245c1
6 changed files with 19 additions and 4 deletions
4
vips.go
4
vips.go
|
|
@ -45,6 +45,7 @@ type VipsMemoryInfo struct {
|
|||
|
||||
// vipsSaveOptions represents the internal option used to talk with libvips.
|
||||
type vipsSaveOptions struct {
|
||||
Speed int
|
||||
Quality int
|
||||
Compression int
|
||||
Type ImageType
|
||||
|
|
@ -493,6 +494,7 @@ func vipsSave(image *C.VipsImage, o vipsSaveOptions) ([]byte, error) {
|
|||
strip := C.int(boolToInt(o.StripMetadata))
|
||||
lossless := C.int(boolToInt(o.Lossless))
|
||||
palette := C.int(boolToInt(o.Palette))
|
||||
speed := C.int(o.Speed)
|
||||
|
||||
if o.Type != 0 && !IsTypeSupportedSave(o.Type) {
|
||||
return nil, fmt.Errorf("VIPS cannot save to %#v", ImageTypes[o.Type])
|
||||
|
|
@ -508,7 +510,7 @@ func vipsSave(image *C.VipsImage, o vipsSaveOptions) ([]byte, error) {
|
|||
case HEIF:
|
||||
saveErr = C.vips_heifsave_bridge(tmpImage, &ptr, &length, strip, quality, lossless)
|
||||
case AVIF:
|
||||
saveErr = C.vips_avifsave_bridge(tmpImage, &ptr, &length, strip, quality, lossless)
|
||||
saveErr = C.vips_avifsave_bridge(tmpImage, &ptr, &length, strip, quality, lossless, speed)
|
||||
default:
|
||||
saveErr = C.vips_jpegsave_bridge(tmpImage, &ptr, &length, strip, quality, interlace)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue