diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs
index b0bdbf0ed..be03a7e7b 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs
@@ -28,7 +28,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
///
public Image Decode(Configuration configuration, Stream stream)
- => this.Decode(configuration, stream);
+ => this.Decode(configuration, stream);
///
public Task> DecodeAsync(Configuration configuration, Stream stream, CancellationToken cancellationToken)
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs
index 7002bfd65..021e3d272 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs
@@ -13,9 +13,9 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public partial class JpegDecoderTests
{
[Theory]
- [WithFileCollection(nameof(BaselineTestJpegs), PixelTypes.Rgba32, false)]
- [WithFile(TestImages.Jpeg.Baseline.Calliphora, PixelTypes.Rgba32, true)]
- [WithFile(TestImages.Jpeg.Baseline.Turtle420, PixelTypes.Rgba32, true)]
+ [WithFileCollection(nameof(BaselineTestJpegs), PixelTypes.Rgb24, false)]
+ [WithFile(TestImages.Jpeg.Baseline.Calliphora, PixelTypes.Rgb24, true)]
+ [WithFile(TestImages.Jpeg.Baseline.Turtle420, PixelTypes.Rgb24, true)]
public void DecodeBaselineJpeg(TestImageProvider provider, bool enforceDiscontiguousBuffers)
where TPixel : unmanaged, IPixel
{
@@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
if (!string.IsNullOrEmpty(nonContiguousBuffersStr))
{
- provider.LimitAllocatorBufferCapacity().InPixels(1000 * 8);
+ provider.LimitAllocatorBufferCapacity().InPixels(16_000);
}
using Image image = provider.GetImage(JpegDecoder);
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
index e5f8989c5..e4fa13719 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
@@ -83,7 +83,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
using (var stream = new MemoryStream(testFile.Bytes, false))
{
var decoder = new JpegDecoder();
- using (Image image = decoder.Decode(Configuration.Default, stream))
+ using (Image image = decoder.Decode(Configuration.Default, stream))
{
ImageMetadata meta = image.Metadata;
Assert.Equal(xResolution, meta.HorizontalResolution);
@@ -130,7 +130,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
var testFile = TestFile.Create(imagePath);
using (var stream = new MemoryStream(testFile.Bytes, false))
{
- using (Image image = JpegDecoder.Decode(Configuration.Default, stream))
+ using (Image image = JpegDecoder.Decode(Configuration.Default, stream))
{
JpegMetadata meta = image.Metadata.GetJpegMetadata();
Assert.Equal(quality, meta.Quality);
@@ -159,11 +159,11 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
}
[Theory]
- [WithFile(TestImages.Jpeg.Baseline.Floorplan, PixelTypes.Rgba32, JpegColorType.Luminance)]
- [WithFile(TestImages.Jpeg.Baseline.Jpeg420Small, PixelTypes.Rgba32, JpegColorType.YCbCrRatio420)]
- [WithFile(TestImages.Jpeg.Baseline.Jpeg444, PixelTypes.Rgba32, JpegColorType.YCbCrRatio444)]
- [WithFile(TestImages.Jpeg.Baseline.JpegRgb, PixelTypes.Rgba32, JpegColorType.Rgb)]
- [WithFile(TestImages.Jpeg.Baseline.Cmyk, PixelTypes.Rgba32, JpegColorType.Cmyk)]
+ [WithFile(TestImages.Jpeg.Baseline.Floorplan, PixelTypes.Rgb24, JpegColorType.Luminance)]
+ [WithFile(TestImages.Jpeg.Baseline.Jpeg420Small, PixelTypes.Rgb24, JpegColorType.YCbCrRatio420)]
+ [WithFile(TestImages.Jpeg.Baseline.Jpeg444, PixelTypes.Rgb24, JpegColorType.YCbCrRatio444)]
+ [WithFile(TestImages.Jpeg.Baseline.JpegRgb, PixelTypes.Rgb24, JpegColorType.Rgb)]
+ [WithFile(TestImages.Jpeg.Baseline.Cmyk, PixelTypes.Rgb24, JpegColorType.Cmyk)]
public void Decode_DetectsCorrectColorType(TestImageProvider provider, JpegColorType expectedColorType)
where TPixel : unmanaged, IPixel
{
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs
index 9beb8358c..e8533b9bc 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs
@@ -15,7 +15,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public const string DecodeProgressiveJpegOutputName = "DecodeProgressiveJpeg";
[Theory]
- [WithFileCollection(nameof(ProgressiveTestJpegs), PixelTypes.Rgba32)]
+ [WithFileCollection(nameof(ProgressiveTestJpegs), PixelTypes.Rgb24)]
public void DecodeProgressiveJpeg(TestImageProvider provider)
where TPixel : unmanaged, IPixel
{
@@ -30,17 +30,17 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
}
[Theory]
- [WithFile(TestImages.Jpeg.Progressive.Progress, PixelTypes.Rgba32)]
- public void DecodeProgressiveJpeg_WithLimitedAllocatorBufferCapacity(TestImageProvider provider)
+ [WithFile(TestImages.Jpeg.Progressive.Progress, PixelTypes.Rgb24)]
+ public void DecodeProgressiveJpeg_WithLimitedAllocatorBufferCapacity(TestImageProvider provider)
{
static void RunTest(string providerDump, string nonContiguousBuffersStr)
{
- TestImageProvider provider =
- BasicSerializer.Deserialize>(providerDump);
+ TestImageProvider provider =
+ BasicSerializer.Deserialize>(providerDump);
provider.LimitAllocatorBufferCapacity().InBytesSqrt(200);
- using Image image = provider.GetImage(JpegDecoder);
+ using Image image = provider.GetImage(JpegDecoder);
image.DebugSave(provider, nonContiguousBuffersStr);
provider.Utility.TestName = DecodeProgressiveJpegOutputName;
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
index 2a18a2c10..2cbc29027 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
@@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[Trait("Format", "Jpg")]
public partial class JpegDecoderTests
{
- public const PixelTypes CommonNonDefaultPixelTypes = PixelTypes.Rgba32 | PixelTypes.Argb32 | PixelTypes.RgbaVector;
+ public const PixelTypes CommonNonDefaultPixelTypes = PixelTypes.Rgba32 | PixelTypes.Argb32 | PixelTypes.Bgr24 | PixelTypes.RgbaVector;
private const float BaselineTolerance = 0.001F / 100;
@@ -85,6 +85,14 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public const string DecodeBaselineJpegOutputName = "DecodeBaselineJpeg";
+ [Fact]
+ public void Decode_NonGeneric_CreatesRgb24Image()
+ {
+ string file = Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, TestImages.Jpeg.Baseline.Jpeg420Small);
+ using var image = Image.Load(file);
+ Assert.IsType>(image);
+ }
+
[Theory]
[WithFile(TestImages.Jpeg.Baseline.Calliphora, CommonNonDefaultPixelTypes)]
public void JpegDecoder_IsNotBoundToSinglePixelType(TestImageProvider provider)