ImageSharp icon indicating copy to clipboard operation
ImageSharp copied to clipboard

Tiff: BigEndian + Rgba16161616TiffColor + associatedAlpha decode tiff as black image

Open Socolin opened this issue 2 weeks ago • 0 comments

Prerequisites

  • [x] I have written a descriptive issue title
  • [x] I have verified that I am running the latest version of ImageSharp
  • [x] I have verified if the problem exist in both DEBUG and RELEASE mode
  • [x] I have searched open and closed issues to ensure it has not already been reported

ImageSharp version

4.0.0-alpha.0.55

Other ImageSharp packages and versions

none

Environment (Operating system, version and so on)

Ubuntu 24.04

.NET Framework version

.net 9.0

Description

When decoding a tiff image storing pixel with 16 bit per color component, big endian and associated alpha the loaded image is black (The transparency seem right)

The pixel become black here https://github.com/SixLabors/ImageSharp/blob/main/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16161616TiffColor%7BTPixel%7D.cs#L68 And the problem seems to be in TiffUtilities.ColorFromRgba64Premultiplied: https://github.com/SixLabors/ImageSharp/blob/main/src/ImageSharp/Formats/Tiff/Utils/TiffUtilities.cs#L48

Steps to Reproduce

Source image: repro.tif

var image = Image.Load<Rgba32>("repro.tif");
await image.SaveAsync("test-tiff.png");

Result Image

Expected:

Image

Images

No response

Socolin avatar Dec 11 '25 03:12 Socolin