Skip to content

x/image/webp: unable to decode image #60437

Open
golang/image
#16
@jmooring

Description

@jmooring

What version of Go are you using (go version)?

go version go1.20.4 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jmooring/.cache/go-build"
GOENV="/home/jmooring/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jmooring/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jmooring/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/current"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/current/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build960738136=/tmp/go-build -gno-record-gcc-switches"

What did you do?

main.go
package main

import (
	"fmt"
	"image"
	"log"
	"os"

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

func main() {
	reader, err := os.Open(os.Args[1])
	if err != nil {
		log.Fatal(err)
	}

	m, _, err := image.Decode(reader)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Successfully decoded %s. Image bounds: %s\n", os.Args[1], m.Bounds())
}
go run . test.webp

What did you expect to see?

Successfully decoded test.webp. Image bounds: (0,0)-(210,210)

What did you see instead?

2023/05/25 11:56:07 webp: invalid format
exit status 1

Notes

This is not an animated WebP image.

This image is not corrupt:

  • It displays as expected in Chrome and Firefox
  • It displays as expected in Microsoft Visual Studio Code
  • It can be converted with cwebp
  • It can be processed with ImageMagick
  • It can be processed with exiftool

Test image

test.webp

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions