disintegration / imaging

Imaging is a simple image processing package for Go
MIT License
5.22k stars 433 forks source link

imaging.Open throw error: image: unknown format #149

Closed leoboboyan closed 2 years ago

leoboboyan commented 2 years ago

Hi

Thanks for your time. My code works fine with most images, but only one image throw an error for now. When opening this image, it throws: image: unknown format o .

disintegration commented 2 years ago

Hi,

Looks like it's a WEBP image, not JPEG:

$ file 133880698-15a934ec-6efd-4113-83f1-245a034d7e5a.jpg
133880698-15a934ec-6efd-4113-83f1-245a034d7e5a.jpg: RIFF (little-endian) data, Web/P image, VP8 encoding, 500x499, Scaling: [none]x[none], YUV color, decoders should clamp

Try adding the following import to enable webp decoder:

import _ "golang.org/x/image/webp"

Docs: https://pkg.go.dev/golang.org/x/image/webp

leoboboyan commented 2 years ago

Hi,

Looks like it's a WEBP image, not JPEG:

$ file 133880698-15a934ec-6efd-4113-83f1-245a034d7e5a.jpg
133880698-15a934ec-6efd-4113-83f1-245a034d7e5a.jpg: RIFF (little-endian) data, Web/P image, VP8 encoding, 500x499, Scaling: [none]x[none], YUV color, decoders should clamp

Try adding the following import to enable webp decoder:

import _ "golang.org/x/image/webp"

Docs: https://pkg.go.dev/golang.org/x/image/webp

thanks