webp: allow VP8L + VP8X(with alpha) Fixes golang/go#60437 Change-Id: I8d8ed597b7f92e136ab2af980b6b223235d8c90d GitHub-Last-Rev: 5912bdb6fccecaab6106ad39f566cc60935b3387 GitHub-Pull-Request: golang/image#16 Reviewed-on: https://go-review.googlesource.com/c/image/+/498535 Reviewed-by: Nigel Tao <nigeltao@golang.org> Reviewed-by: Nigel Tao <nigeltao@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/testdata/gopher-doc.with-alpha.lossless.webp b/testdata/gopher-doc.with-alpha.lossless.webp new file mode 100644 index 0000000..fe5018d --- /dev/null +++ b/testdata/gopher-doc.with-alpha.lossless.webp Binary files differ
diff --git a/testdata/gopher-doc.with-alpha.png b/testdata/gopher-doc.with-alpha.png new file mode 100644 index 0000000..ba3236b --- /dev/null +++ b/testdata/gopher-doc.with-alpha.png Binary files differ
diff --git a/webp/decode.go b/webp/decode.go index 0df3c67..2371808 100644 --- a/webp/decode.go +++ b/webp/decode.go
@@ -103,7 +103,7 @@ return m, image.Config{}, nil case fccVP8L: - if wantAlpha || alpha != nil { + if alpha != nil { return nil, image.Config{}, errInvalidFormat } if configOnly {
diff --git a/webp/decode_test.go b/webp/decode_test.go index 00be03f..bb50ddd 100644 --- a/webp/decode_test.go +++ b/webp/decode_test.go
@@ -177,6 +177,7 @@ "gopher-doc.2bpp", "gopher-doc.4bpp", "gopher-doc.8bpp", + "gopher-doc.with-alpha", "tux", "yellow_rose", }