image-tiff icon indicating copy to clipboard operation
image-tiff copied to clipboard

TIFF files with unassociated extra samples are unsupported.

Open Aerocatia opened this issue 3 years ago • 8 comments

TIFF files with 2 samples per pixel (Luminance + Alpha) are unsupported by this library. Such TIFF files are the default output of imagemagick if the input is grayscale.

Attached is an example. example_tiff.zip

Aerocatia avatar Oct 19 '22 16:10 Aerocatia

Do you know where specifically the error is coming from? GrayA is listed as a supported color type and I believe that most of the code doesn't care how many samples per pixel there are.

fintelia avatar Oct 19 '22 21:10 fintelia

It seems, imagemagick does not encode it as a truly alpha component but as a mask:

$ tiffinfo *
TIFF Directory at offset 0x80008 (524296)
  Image Width: 512 Image Length: 512
  Resolution: 1, 1 (unitless)
  Bits/Sample: 8
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  Extra Samples: 1<unassoc-alpha>
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 2
  Rows/Strip: 512
  Planar Configuration: single image plane
  Page Number: 0-1
  White Point: 0.3127-0.329
  PrimaryChromaticities: 0.640000,0.330000,0.300000,0.600000,0.150000,0.060000

This is probably intended in this case (pistol_scope_mask.tif) but quite possibly the reason that it's not commonly encountered or reported as such.

The library doesn't guess the meaning of extra channels and unassociated extra samples aren't supported.

197g avatar Oct 20 '22 06:10 197g