bimg
bimg copied to clipboard
GIF conversion: Unsupported image output type
Go version 1.17
GCC version 11.1.0
Vips version 8.11.3
code sample
package main
import (
"log"
"github.com/h2non/bimg"
)
func main() {
buffer, err := bimg.Read("/test.gif")
if err != nil {
log.Fatal(err)
}
image := bimg.NewImage(buffer)
options := bimg.Options {
Width: 64,
Height: 64,
Crop: true,
Quality: 90,
}
buffer, err = image.Process(options)
if err != nil {
log.Fatal(err)
}
if err = bimg.Write("/test_cropped.gif", buffer); err != nil {
log.Fatal(err)
}
}
output
Unsupported image output type
There something to installing vips which isn't reflected in the documentation but hinted at here?
if [email protected]+ is compiled with proper library bindings
Edit:
For context this is happening on both my local Arch Linux machine and an Alpine Docker Image we are trying to build. Both setups have vips
versions of 8.10+
installed.
Give it a shot with the in-development version 2:
go get -u github.com/h2non/bimg/v2@v2-dev
. The API is not stable yet, though.
See #403, you need a libvips that has GIF support compiled in. The current version on arch depends on libcgif, so it should be working.
Give it a shot with the in-development version 2:
go get -u github.com/h2non/bimg/v2@v2-dev
. The API is not stable yet, though.
processed, err := bimg.NewImage(buffer).Process(bimg.Options{
Type: bimg.GIF,
Quality: quality,
Gravity: bimg.GravityCentre,
})
if err != nil {
return filename, err
}
if err := bimg.Write(fmt.Sprintf("./"+dirname+"/%s", filename), processed); err != nil {
return filename, err
}
it cant support Write Gif output?