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

x/image/tiff: no support for cJPEG or cJPEGOld #23115

Open
gdunstone opened this issue Dec 13, 2017 · 1 comment
Open

x/image/tiff: no support for cJPEG or cJPEGOld #23115

gdunstone opened this issue Dec 13, 2017 · 1 comment

Comments

@gdunstone
Copy link

@gdunstone gdunstone commented Dec 13, 2017

What did you do?

tried to decode a jpeg compressed tiff or a canon raw (weird tiff with jpeg data)

What did you expect to see?

the image to be decoded correctly without errors.

What did you see instead?

with a cr2:
tiff: unsupported feature: compression value 6
with a tiff with proper jpeg compressed image data:
tiff: unsupported feature: compression value 7

System details

go version go1.9.2 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/gareth/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build053335415=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOROOT/bin/go version: go version go1.9.2 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.9.2
uname -sr: Linux 4.14.4-1-ARCH
LSB Version:	1.4
Distributor ID:	Arch
Description:	Arch Linux
Release:	rolling
Codename:	n/a
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.26, by Roland McGrath et al.
gdb --version: GNU gdb (GDB) 8.0.1
@gopherbot gopherbot added this to the Unreleased milestone Dec 13, 2017
@gdunstone

This comment has been minimized.

Copy link
Author

@gdunstone gdunstone commented Dec 13, 2017

I added some code to x/image/tiff/reader.go that allows the module to correctly load cr2 files:

case cJPEGOld:
	a := io.NewSectionReader(d.r, offset, n)
	img, err = jpeg.Decode(a)
	if err != nil{
		return nil, err
	}
	return

however decoding cJPEG like this causes this error:
invalid JPEG format: uninitialized Huffman table
which I don't know how to debug.

I would create a pull request for the cJPEGOld code, however I have no "old" jpeg formatted tiffs to test it with other than cr2s.

@bradfitz bradfitz changed the title x/image/tiff no support for cJPEG or cJPEGOld x/image/tiff: no support for cJPEG or cJPEGOld Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.