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

8 and 16 bit gray-scale (and others) tiff Encode outputs defective on Mac - two 1/2 x1/2 images #6421

Closed
gopherbot opened this issue Sep 19, 2013 · 6 comments

Comments

@gopherbot
Copy link

by gbulmer:

What steps will reproduce the problem?

Each one of the following results in an image which does not display correctly using
Finder Preview, Safari, Preview or MS Mac Word

1. 'go build'  image04.go (attached)

2. 'go build'  image03.go (attached)

3. move the attached file writer2_test.go into the go.image/tiff directory, run "go
test"
This generates a set of files prefixed with roundtrip., and optionally
"predictor." or "deflate." in the go.image/testdata directory

What is the expected output?
1. A 1D grey gradient, ranging from black on the left to white on the right. Each
vertical line of pixels is the same shade of grey

2. A 2D gray gradient, ranging from black in the top left corner, down to white bottom
right.

3. Images called go.image/testdata/roundtrip.(predictor.)?(deflate.)?xx.tiff should look
identical to the test image go.image/testdata/xx.tiff


What do you see instead?
1. results in an 8-bit tiff (attached gray.tiff) which is displayed by Preview and
Safari as two 1/2 x 1/2 scale image, repeated twice, once top left quadrant, once top
right quadrant. The lower two quadrants seem to be transparent as they are displayed as
the window background colour (mid gray for Preview, white for Safari)

2. results in an 16-bit tiff (attached gray16.tiff) which is also displayed as 1/2 x 1/2
scale in the same way as 1

3. The files where the roundtrip.xx.tiff file (created by tiff.Decode then tiff.Encode)
which do not correctly display on Finder Preview, Mac Safari or Mac Preview are:
go.image/testdata/roundtrip.bw-packbits.tiff
go.image/testdata/roundtrip.video-001-gray-16bit.tiff
go.image/testdata/roundtrip.video-001-gray.tiff

Two original go.image/testdata files are attached gray.tiff and gray16.tiff for
comparison

A colour file which does not display correctly with Finder Preview, Mac Safari or Mac
Preview:
go.image/testdata/roundtrip.predictor.video-001.tiff
It shows as a single vertical line of color pixels in Finder Preview

This file does not display at all
go.image/testdata/roundtrip.video-001-paletted.tiff

One result is in an 8-bit tiff (attached roundtrip.video-001-gray.tiff) which is
displayed as 1/2 x 1/2 scale in the same way as 1 and 2

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Mac (OS X 10.6.8)

Which version are you using?  (run 'go version')
go version go1.1.2 darwin/amd64

Please provide any additional information below.

The writer2_test.go file also generates png.Encoded files. These all seem to be correct,
and match the original test file. 

Attached is an example of the image go.image/testdata/roundtrip.video-001-gray.tiff
printed to pdf (roundtrip.video-001-gray.tiff.pdf) from Preview, showing the two 1/2 x
1/2 scale top 2 quadrant images

Also attached is the same image saved as a .png which shows the 1/2 x 1/2 top quadrants
effect

Also attached is an MS Mac Word document (roundtrip.video-001-gray.tiff.docx) which
displays the image as two 1/2 x 1/2 scale images in the top two quadrants.

HOWEVER Firefox 23.0.1 renders roundtrip.video-001-gray.tiff correctly, so that it looks
the same as the original.

Attachments:

  1. writer2_test.go (1106 bytes)
  2. roundtrip.video-001-gray.tiff (15648 bytes)
  3. roundtrip.video-001-gray.preview.png (11267 bytes)
  4. roundtrip.video-001-gray.tiff.pdf (18344 bytes)
  5. roundtrip.video-001-gray.tiff.docx (45894 bytes)
  6. image04.go (615 bytes)
  7. gray.tiff (65734 bytes)
  8. image03.go (622 bytes)
  9. gray16.tiff (1036 bytes)
@nigeltao
Copy link
Contributor

Comment 1:

chaishushan, you've been changing the go.image/tiff code lately, including grayscale
images. Can you have a look at this?

Owner changed to @nigeltao.

@nigeltao
Copy link
Contributor

Comment 2:

Status changed to Accepted.

@chai2010
Copy link
Contributor

Comment 3:

nigeltao, i will review this issue, and reply soon.

@chai2010
Copy link
Contributor

Comment 4:

nigeltao,
I read the TIFF6.0 Spec again, and found:
Page 39: SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64: Currently Predictor field is used only with LZW.
If we fix the 2 bug, roundtrip.predictor.video-001.tiff and
roundtrip.video-001-paletted.tiff will ok.

@chai2010
Copy link
Contributor

Comment 5:

The patch has been sent as https://golang.org/cl/13779043/

@nigeltao
Copy link
Contributor

Comment 6:

This issue was closed by revision golang/image@420d421.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
olt pushed a commit to olt/golang-x-image that referenced this issue Jan 10, 2019
…ixel and non RGB ExtraSamples.

TIFF6.0 Spec:
Page 31: ExtraSamples can only included in RGB mode image.
Page 39, SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64, Currently Predictor field is used only with LZW.

Fixes golang/go#6421.

R=bsiegert, nigeltao, gbulmer
CC=golang-dev
https://golang.org/cl/13779043
mrhyperbit23z0d added a commit to mrhyperbit23z0d/bhegde8 that referenced this issue Jun 6, 2022
…ixel and non RGB ExtraSamples.

TIFF6.0 Spec:
Page 31: ExtraSamples can only included in RGB mode image.
Page 39, SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64, Currently Predictor field is used only with LZW.

Fixes golang/go#6421.

R=bsiegert, nigeltao, gbulmer
CC=golang-dev
https://golang.org/cl/13779043
GalaxyForcew added a commit to GalaxyForcew/A1bisshy that referenced this issue Jun 6, 2022
…ixel and non RGB ExtraSamples.

TIFF6.0 Spec:
Page 31: ExtraSamples can only included in RGB mode image.
Page 39, SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64, Currently Predictor field is used only with LZW.

Fixes golang/go#6421.

R=bsiegert, nigeltao, gbulmer
CC=golang-dev
https://golang.org/cl/13779043
yi-ge3 added a commit to yi-ge3/wislie that referenced this issue Jun 6, 2022
…ixel and non RGB ExtraSamples.

TIFF6.0 Spec:
Page 31: ExtraSamples can only included in RGB mode image.
Page 39, SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64, Currently Predictor field is used only with LZW.

Fixes golang/go#6421.

R=bsiegert, nigeltao, gbulmer
CC=golang-dev
https://golang.org/cl/13779043
balloontmz6 added a commit to balloontmz6/Likewise42l that referenced this issue Jun 6, 2022
…ixel and non RGB ExtraSamples.

TIFF6.0 Spec:
Page 31: ExtraSamples can only included in RGB mode image.
Page 39, SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64, Currently Predictor field is used only with LZW.

Fixes golang/go#6421.

R=bsiegert, nigeltao, gbulmer
CC=golang-dev
https://golang.org/cl/13779043
snapbakkhfbav added a commit to snapbakkhfbav/SayedBaladohr that referenced this issue Oct 6, 2022
…ixel and non RGB ExtraSamples.

TIFF6.0 Spec:
Page 31: ExtraSamples can only included in RGB mode image.
Page 39, SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64, Currently Predictor field is used only with LZW.

Fixes golang/go#6421.

R=bsiegert, nigeltao, gbulmer
CC=golang-dev
https://golang.org/cl/13779043
MiderWong5ddop added a commit to MiderWong5ddop/sidie88f that referenced this issue Oct 7, 2022
…ixel and non RGB ExtraSamples.

TIFF6.0 Spec:
Page 31: ExtraSamples can only included in RGB mode image.
Page 39, SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64, Currently Predictor field is used only with LZW.

Fixes golang/go#6421.

R=bsiegert, nigeltao, gbulmer
CC=golang-dev
https://golang.org/cl/13779043
rorypeckwnt4v added a commit to rorypeckwnt4v/LearnByBhanuPrataph that referenced this issue Oct 7, 2022
…ixel and non RGB ExtraSamples.

TIFF6.0 Spec:
Page 31: ExtraSamples can only included in RGB mode image.
Page 39, SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64, Currently Predictor field is used only with LZW.

Fixes golang/go#6421.

R=bsiegert, nigeltao, gbulmer
CC=golang-dev
https://golang.org/cl/13779043
egorovcharenko9 added a commit to egorovcharenko9/RiceBIOC470z that referenced this issue Oct 7, 2022
…ixel and non RGB ExtraSamples.

TIFF6.0 Spec:
Page 31: ExtraSamples can only included in RGB mode image.
Page 39, SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64, Currently Predictor field is used only with LZW.

Fixes golang/go#6421.

R=bsiegert, nigeltao, gbulmer
CC=golang-dev
https://golang.org/cl/13779043
RafayGhafoorf added a commit to RafayGhafoorf/dustinsand8 that referenced this issue Oct 7, 2022
…ixel and non RGB ExtraSamples.

TIFF6.0 Spec:
Page 31: ExtraSamples can only included in RGB mode image.
Page 39, SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images.
Page 64, Currently Predictor field is used only with LZW.

Fixes golang/go#6421.

R=bsiegert, nigeltao, gbulmer
CC=golang-dev
https://golang.org/cl/13779043
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants