You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Saving an example tiff file back to disk using the default TiffEncoder settings changes the image #2909
I have verified that I am running the latest version of ImageSharp
I have verified if the problem exist in both DEBUG and RELEASE mode
I have searched open and closed issues to ensure it has not already been reported
ImageSharp version
3.1.7
Other ImageSharp packages and versions
SixLabors.ImageSharp.Drawing 2.1.5
Environment (Operating system, version and so on)
Windows 11 (also tested in WSL)
.NET Framework version
8
Description
Given the following image of a simple 2x2 black-and-white checkerboard:
Running this through ImageSharp's default load and save results in the lower-right corner (mostly) vanishing:
The equivalent image for png/gif/jpeg/bmp does not cut off the corner in this way, so it seems to have something to do with tiff encoding, and tiff compression in particular.
(Note the attached images are PNGs only because Github won't let me upload tifs directly. I've included the original files in a zip.)
Steps to Reproduce
Loading and saving the tiff file like should reproduce the corner effect:
using (SixLabors.ImageSharp.Image<Rgba32> image = SixLabors.ImageSharp.Image.Load<Rgba32>(path + "example32x32.tif"))
{
using (FileStream stream = new FileStream(path + "example32x32-new.tif", FileMode.Create))
{
image.Save(stream, new TiffEncoder());
}
}
(I also get the same result if dropping the generic.)
The only way to get the image save correctly it seems is to specify no compression:
using (SixLabors.ImageSharp.Image<Rgba32> image = SixLabors.ImageSharp.Image.Load<Rgba32>(path + "example32x32.tif"))
{
using (FileStream stream = new FileStream(path + "example32x32-new-no-compression.tif", FileMode.Create))
{
image.Save(stream, new TiffEncoder() { Compression = SixLabors.ImageSharp.Formats.Tiff.Constants.TiffCompression.None });
}
}
Activity