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
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
2.1.2
Other ImageSharp packages and versions
SixLabors.ImageSharp 2.1.2
Environment (Operating system, version and so on)
Windows 11 and Ubuntu 20.04.4 LTS
.NET Framework version
.NET 6 (SDK 6.0.300)
Description
JPEG images with ColorType value of JpegColorType.Rgb have their color values read/parsed incorrectly.
Though such images are rare, I encountered multiple such images already and all of them were read incorrectly. Other image readers and tools read them correctly.
Example code:
usingvarimage=Image.Load(filePath);varcolorType=image.Metadata.GetJpegMetadata().ColorType;if(colorType==JpegColorType.Rgb){// colors will be read wrong}// you can save it as anything, doesn't matterimage.SaveAsJpeg("output.jpg");
Just to get an idea of how colors change with an example input image. This is the original:
The output is this:
Steps to Reproduce
This works on any JPEG image that has ColorType = JpegColorType.Rgb
Load any such image by using Image.Load(filepath); or Image.Load<Rgba32>(filepath);
You can try reading some pixels to confirm the colors are off
Save image using any method, I used image.SaveAsJpeg(outputPath);
The output should be very different from the input.
Images
Original (input image):
The text was updated successfully, but these errors were encountered:
Prerequisites
DEBUG
andRELEASE
modeImageSharp version
2.1.2
Other ImageSharp packages and versions
SixLabors.ImageSharp 2.1.2
Environment (Operating system, version and so on)
Windows 11 and Ubuntu 20.04.4 LTS
.NET Framework version
.NET 6 (SDK 6.0.300)
Description
JPEG images with ColorType value of
JpegColorType.Rgb
have their color values read/parsed incorrectly.Though such images are rare, I encountered multiple such images already and all of them were read incorrectly. Other image readers and tools read them correctly.
Example code:
Just to get an idea of how colors change with an example input image. This is the original:

The output is this:

Steps to Reproduce
This works on any JPEG image that has
ColorType
=JpegColorType.Rgb
Image.Load(filepath);
orImage.Load<Rgba32>(filepath);
image.SaveAsJpeg(outputPath);
The output should be very different from the input.
Images
Original (input image):

The text was updated successfully, but these errors were encountered: