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 · 3 comments · May be fixed by golang/image#7
Open

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

gdunstone opened this issue Dec 13, 2017 · 3 comments · May be fixed by golang/image#7
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@gdunstone
Copy link

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
Copy link
Author

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
@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 3, 2018
@sunshineplan
Copy link

I added cJPEG support in my repository, but still no good unit tests for it.
https://github.com/sunshineplan/tiff

@gopherbot
Copy link

Change https://golang.org/cl/333249 mentions this issue: tiff: Read/write support for JPEG-based compression (TIFF compression scheme 7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants