ImageSharp
ImageSharp copied to clipboard
Tiff: BigEndian + Rgba16161616TiffColor + associatedAlpha decode tiff as black image
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
DEBUGandRELEASEmode - [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
Expected:
Images
No response