go: x/image/tiff: package doesn't support CCITT Fax 4 Compression

Please answer these questions before submitting your issue. Thanks!

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

go1.8 darwin/amd64

What operating system and processor architecture are you using (go env)?

Darwin/amd64

What did you do?

Take a tiff image with CCITT Fax 4 Compression and attempt to decode it with the golang.org/x/image/tiff package.

What did you expect to see?

I expected a level 4 compressed tiff to decode properly.

What did you see instead?

tiff: unsupported feature: compression value 4

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 19 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I can contribute an enhanced version of x/image/tiff that features:

  • CCITT decoding for group3/1d and group4
  • CMYK reading and writing
  • an improved version of compress/lzw (see #25409)

Right now it’s all located at pdfcpu. Please let me know if this is worth a PR. Thank you!

new.tiff.zip

package main

import (
	"bytes"
	"image"
	"image/png"
	"io/ioutil"
	"log"

	_ "golang.org/x/image/tiff"
)

func main() {
	b, err := ioutil.ReadFile("new.tiff")

	reader := bytes.NewReader(b)
	img, _, err := image.Decode(reader)
	if err != nil {
		log.Fatal(err)
	}

	w := bytes.NewBuffer([]byte{})
	err = png.Encode(w, img)
	if err != nil {
		log.Fatal(err)
	}
}

Output:

2017/03/07 09:03:46 tiff: unsupported feature: compression value 4
exit status 1