Skip to content

x/image/tiff: Unable to decode DNG files with external package #57746

Open
@mholt

Description

@mholt

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

$ go version
go version go1.19.1 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
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/matt/.cache/go-build"
GOENV="/home/matt/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/matt/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/matt/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1397311274=/tmp/go-build -gno-record-gcc-switches"

What did you do?

The x/image/tiff package is in conflict with DNG decoder packages because it registers its format on init(), even though TIFF files and DNG files look similar.

I suppose one of these solutions must work:

  • x/image/tiff should support decoding DNG files
  • or it should use a more specific "magic" header if possible
  • or it should not register its format on init().

What did you expect to see?

I expect that I should be able to call image.Decode() on a DNG file and have it successfully work using a registered DNG decoder.

The problem is that DNG and TIFF files look similar at the beginning, so registering both the TIFF and DNG formats will cause the TIFF to be used instead of DNG.

I'm not actually decoding TIFF files, but I'm using TIFF APIs because DNG shares some in common.

What did you see instead?

"tiff: unsupported feature: color model"

Currently it doesn't seem possible to use image.Decode() for DNG files.

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