Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image/png: DecodeConfig gives incorrect result for paletted images with transparency #54325

Closed
depp opened this issue Aug 7, 2022 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@depp
Copy link

depp commented Aug 7, 2022

The color model returned from png.DecodeConfig is different from the one returned from png.Decode, because it incorrectly omits the alpha channel data.

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

$ go version
go version go1.19 darwin/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="/Users/depp/Library/Caches/go-build"
GOENV="/Users/depp/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/depp/Projects/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/depp/Projects/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.19/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.19/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1l/g8_2q7j95rndy_wpjnd5b1h00000gn/T/go-build1338501950=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

See go.dev/play snippet

When run, prints

Color 0 (png.DecodeConfig): {0 0 0 255}
Color 0 (png.Decode): {0 0 0 0}

Program exited.

What did you expect to see?

Same color model, no matter whether I used DecodeConfig or Decode

What did you see instead?

Palette entry 0 has alpha = 255 (incorrect) if returned by DecodeConfig, alpha = 0 (correct) if returned by Decode.

@ianlancetaylor ianlancetaylor changed the title image/png: png.DecodeConfig gives incorrect result for paletted images with transparency image/png: DecodeConfig gives incorrect result for paletted images with transparency Aug 7, 2022
@ianlancetaylor
Copy link
Contributor

CC @nigeltao

@thanm thanm added this to the Backlog milestone Aug 9, 2022
@thanm thanm added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 9, 2022
@gopherbot
Copy link

Change https://go.dev/cl/424917 mentions this issue: image/png: have DecodeConfig read tRNS chunks

@dmitshur dmitshur modified the milestones: Backlog, Go1.20 Aug 19, 2022
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 19, 2022
@golang golang locked and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants