bimg icon indicating copy to clipboard operation
bimg copied to clipboard

GIF conversion: Unsupported image output type

Open kim-hetrafi opened this issue 3 years ago • 3 comments

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.

kim-hetrafi avatar Aug 26 '21 12:08 kim-hetrafi

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.

aksdb avatar Dec 13 '21 16:12 aksdb

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.

der-eismann avatar Jun 07 '22 11:06 der-eismann

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?

t101804 avatar Sep 16 '23 10:09 t101804