kolesa-team / go-webp

Simple and fast webp library for golang
MIT License
225 stars 36 forks source link

cannot fetch features: VP8_STATUS_BITSTREAM_ERROR #9

Closed frops closed 3 years ago

frops commented 3 years ago

I'm trying to convert png to webp and getting error "cannot fetch features: VP8_STATUS_BITSTREAM_ERROR".

func (c *ConvertService) ConvertToWebp(file io.Reader, d entities.Dimensions) (image.Image, error) {
    img, err := webp.Decode(file, &decoder.Options{})

    if err != nil {
        return nil, err
    }

    return transform.Resize(img, d.Width, d.Height, transform.Linear), nil
}

OS: macOS Catalina, 10.15.7 Lib: webp 1.2.1 Go: 1.17

lEx0 commented 3 years ago

are you opening png file with webp decoder?

frops commented 3 years ago

are you opening png file with webp decoder?

No, i'm using io.Reader

lEx0 commented 3 years ago

If I understand correctly, you try to open png file by webp decoder, right? if i'm right, firstly you have to open png file with png decoder and try encode result image.Image with webp encoder to create webp picture