diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 4828f4f21..5189f0435 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -1,19 +1,37 @@
name: Build
on:
- push:
- branches:
- - master
- tags:
- - "v*"
- pull_request:
- branches:
- - master
+ push:
+ branches:
+ - master
+ tags:
+ - "v*"
+ pull_request:
+ branches:
+ - master
jobs:
Build:
strategy:
matrix:
options:
+ - os: ubuntu-latest
+ framework: net6.0
+ sdk: 6.0.x
+ sdk-preview: true
+ runtime: -x64
+ codecov: false
+ - os: macos-latest
+ framework: net6.0
+ sdk: 6.0.x
+ sdk-preview: true
+ runtime: -x64
+ codecov: false
+ - os: windows-latest
+ framework: net6.0
+ sdk: 6.0.x
+ sdk-preview: true
+ runtime: -x64
+ codecov: false
- os: ubuntu-latest
framework: net5.0
runtime: -x64
@@ -52,37 +70,38 @@ jobs:
codecov: false
runs-on: ${{matrix.options.os}}
- if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- - uses: actions/checkout@v2
+ - name: Git Config
+ shell: bash
+ run: |
+ git config --global core.autocrlf false
+ git config --global core.longpaths true
+
+ - name: Git Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ submodules: recursive
# See https://github.com/actions/checkout/issues/165#issuecomment-657673315
- - name: Create LFS file list
+ - name: Git Create LFS FileList
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
- - name: Restore LFS cache
+ - name: Git Setup LFS Cache
uses: actions/cache@v2
id: lfs-cache
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1
- - name: Git LFS Pull
+ - name: Git Pull LFS
run: git lfs pull
- - name: Install NuGet
+ - name: NuGet Install
uses: NuGet/setup-nuget@v1
- - name: Setup Git
- shell: bash
- run: |
- git config --global core.autocrlf false
- git config --global core.longpaths true
- git fetch --prune --unshallow
- git submodule -q update --init --recursive
-
- - name: Setup NuGet Cache
+ - name: NuGet Setup Cache
uses: actions/cache@v2
id: nuget-cache
with:
@@ -90,60 +109,94 @@ jobs:
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
restore-keys: ${{ runner.os }}-nuget-
- - name: Build
+ - name: DotNet Setup Preview
+ if: ${{ matrix.options.sdk-preview == true }}
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: ${{ matrix.options.sdk }}
+ include-prerelease: true
+
+ - name: DotNet Build
+ if: ${{ matrix.options.sdk-preview != true }}
shell: pwsh
run: ./ci-build.ps1 "${{matrix.options.framework}}"
env:
SIXLABORS_TESTING: True
- - name: Test
+ - name: DotNet Build Preview
+ if: ${{ matrix.options.sdk-preview == true }}
+ shell: pwsh
+ run: ./ci-build.ps1 "${{matrix.options.framework}}"
+ env:
+ SIXLABORS_TESTING_PREVIEW: True
+
+ - name: DotNet Test
+ if: ${{ matrix.options.sdk-preview != true }}
shell: pwsh
run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
env:
- SIXLABORS_TESTING: True
- XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
+ SIXLABORS_TESTING: True
+ XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
+
+ - name: DotNet Test Preview
+ if: ${{ matrix.options.sdk-preview == true }}
+ shell: pwsh
+ run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
+ env:
+ SIXLABORS_TESTING_PREVIEW: True
+ XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
- name: Export Failed Output
uses: actions/upload-artifact@v2
if: failure()
with:
- name: actual_output_${{ runner.os }}_${{ matrix.options.framework }}${{ matrix.options.runtime }}.zip
- path: tests/Images/ActualOutput/
+ name: actual_output_${{ runner.os }}_${{ matrix.options.framework }}${{ matrix.options.runtime }}.zip
+ path: tests/Images/ActualOutput/
- - name: Update Codecov
+ - name: Codecov Update
uses: codecov/codecov-action@v1
if: matrix.options.codecov == true && startsWith(github.repository, 'SixLabors')
with:
- flags: unittests
+ flags: unittests
Publish:
needs: [Build]
- runs-on: windows-latest
+ runs-on: ubuntu-latest
if: (github.event_name == 'push')
steps:
- - uses: actions/checkout@v2
-
- - name: Install NuGet
- uses: NuGet/setup-nuget@v1
-
- - name: Setup Git
+ - name: Git Config
shell: bash
run: |
git config --global core.autocrlf false
git config --global core.longpaths true
- git fetch --prune --unshallow
- git submodule -q update --init --recursive
- - name: Pack
+ - name: Git Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ submodules: recursive
+
+ - name: NuGet Install
+ uses: NuGet/setup-nuget@v1
+
+ - name: NuGet Setup Cache
+ uses: actions/cache@v2
+ id: nuget-cache
+ with:
+ path: ~/.nuget
+ key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
+ restore-keys: ${{ runner.os }}-nuget-
+
+ - name: DotNet Pack
shell: pwsh
run: ./ci-pack.ps1
- - name: Publish to MyGet
+ - name: MyGet Publish
shell: pwsh
run: |
- nuget.exe push .\artifacts\*.nupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v2/package
- nuget.exe push .\artifacts\*.snupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v3/index.json
+ dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.MYGET_TOKEN}} -s https://www.myget.org/F/sixlabors/api/v2/package
+ dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.MYGET_TOKEN}} -s https://www.myget.org/F/sixlabors/api/v3/index.json
# TODO: If github.ref starts with 'refs/tags' then it was tag push and we can optionally push out package to nuget.org
diff --git a/Directory.Build.props b/Directory.Build.props
index b3e18e5a5..3899ce939 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -18,6 +18,11 @@
+
+
+ preview
+
+
false
Debug;Release;Debug-InnerLoop;Release-InnerLoop
- 9
+
+
+ net6.0;net5.0;netcoreapp3.1;netcoreapp2.1;net472
+
+
netcoreapp3.1
diff --git a/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj b/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj
index 10deb24c6..1a470fa31 100644
--- a/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj
+++ b/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj
@@ -14,10 +14,14 @@
false
Debug;Release;Debug-InnerLoop;Release-InnerLoop
false
- 9
+
+
+ net6.0;net5.0;netcoreapp3.1;netcoreapp2.1;net472
+
+
netcoreapp3.1
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
index 403eeaf90..e5f8989c5 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
@@ -67,16 +67,13 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
string imagePath,
int expectedPixelSize,
bool exifProfilePresent,
- bool iccProfilePresent)
- {
- TestMetadataImpl(
+ bool iccProfilePresent) => TestMetadataImpl(
useIdentify,
JpegDecoder,
imagePath,
expectedPixelSize,
exifProfilePresent,
iccProfilePresent);
- }
[Theory]
[MemberData(nameof(RatioFiles))]
@@ -133,8 +130,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
var testFile = TestFile.Create(imagePath);
using (var stream = new MemoryStream(testFile.Bytes, false))
{
- var decoder = new JpegDecoder();
- using (Image image = decoder.Decode(Configuration.Default, stream))
+ using (Image image = JpegDecoder.Decode(Configuration.Default, stream))
{
JpegMetadata meta = image.Metadata.GetJpegMetadata();
Assert.Equal(quality, meta.Quality);
@@ -142,6 +138,42 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
}
}
+ [Theory]
+ [InlineData(TestImages.Jpeg.Baseline.Floorplan, JpegColorType.Luminance)]
+ [InlineData(TestImages.Jpeg.Baseline.Jpeg420Small, JpegColorType.YCbCrRatio420)]
+ [InlineData(TestImages.Jpeg.Baseline.Jpeg444, JpegColorType.YCbCrRatio444)]
+ [InlineData(TestImages.Jpeg.Baseline.JpegRgb, JpegColorType.Rgb)]
+ [InlineData(TestImages.Jpeg.Baseline.Cmyk, JpegColorType.Cmyk)]
+ [InlineData(TestImages.Jpeg.Baseline.Jpeg410, JpegColorType.YCbCrRatio410)]
+ [InlineData(TestImages.Jpeg.Baseline.Jpeg422, JpegColorType.YCbCrRatio422)]
+ [InlineData(TestImages.Jpeg.Baseline.Jpeg411, JpegColorType.YCbCrRatio411)]
+ public void Identify_DetectsCorrectColorType(string imagePath, JpegColorType expectedColorType)
+ {
+ var testFile = TestFile.Create(imagePath);
+ using (var stream = new MemoryStream(testFile.Bytes, false))
+ {
+ IImageInfo image = JpegDecoder.Identify(Configuration.Default, stream);
+ JpegMetadata meta = image.Metadata.GetJpegMetadata();
+ Assert.Equal(expectedColorType, meta.ColorType);
+ }
+ }
+
+ [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)]
+ public void Decode_DetectsCorrectColorType(TestImageProvider provider, JpegColorType expectedColorType)
+ where TPixel : unmanaged, IPixel
+ {
+ using (Image image = provider.GetImage(JpegDecoder))
+ {
+ JpegMetadata meta = image.Metadata.GetJpegMetadata();
+ Assert.Equal(expectedColorType, meta.ColorType);
+ }
+ }
+
private static void TestImageInfo(string imagePath, IImageDecoder decoder, bool useIdentify, Action test)
{
var testFile = TestFile.Create(imagePath);
@@ -161,9 +193,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
string imagePath,
int expectedPixelSize,
bool exifProfilePresent,
- bool iccProfilePresent)
- {
- TestImageInfo(
+ bool iccProfilePresent) => TestImageInfo(
imagePath,
decoder,
useIdentify,
@@ -207,7 +237,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
Assert.Null(iccProfile);
}
});
- }
[Theory]
[InlineData(false)]
@@ -237,9 +266,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[Theory]
[InlineData(false)]
[InlineData(true)]
- public void Decoder_Reads_Correct_Resolution_From_Jfif(bool useIdentify)
- {
- TestImageInfo(
+ public void Decoder_Reads_Correct_Resolution_From_Jfif(bool useIdentify) => TestImageInfo(
TestImages.Jpeg.Baseline.Floorplan,
JpegDecoder,
useIdentify,
@@ -248,14 +275,11 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
Assert.Equal(300, imageInfo.Metadata.HorizontalResolution);
Assert.Equal(300, imageInfo.Metadata.VerticalResolution);
});
- }
[Theory]
[InlineData(false)]
[InlineData(true)]
- public void Decoder_Reads_Correct_Resolution_From_Exif(bool useIdentify)
- {
- TestImageInfo(
+ public void Decoder_Reads_Correct_Resolution_From_Exif(bool useIdentify) => TestImageInfo(
TestImages.Jpeg.Baseline.Jpeg420Exif,
JpegDecoder,
useIdentify,
@@ -264,6 +288,5 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
Assert.Equal(72, imageInfo.Metadata.HorizontalResolution);
Assert.Equal(72, imageInfo.Metadata.VerticalResolution);
});
- }
}
}
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
index e8d307f90..2a18a2c10 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
@@ -74,7 +74,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
byte[] bytes = TestFile.Create(TestImages.Jpeg.Progressive.Progress).Bytes;
using var ms = new MemoryStream(bytes);
using var bufferedStream = new BufferedReadStream(Configuration.Default, ms);
- var decoder = new JpegDecoderCore(Configuration.Default, new JpegDecoder());
+ using var decoder = new JpegDecoderCore(Configuration.Default, new JpegDecoder());
using Image image = decoder.Decode(bufferedStream, cancellationToken: default);
// I don't know why these numbers are different. All I know is that the decoder works
@@ -174,13 +174,26 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
await Assert.ThrowsAsync(async () => await Image.IdentifyAsync(config, "someFakeFile", cts.Token));
}
+ [Theory]
+ [WithFile(TestImages.Jpeg.Baseline.ArithmeticCoding, PixelTypes.Rgba32)]
+ [WithFile(TestImages.Jpeg.Baseline.ArithmeticCodingProgressive, PixelTypes.Rgba32)]
+ [WithFile(TestImages.Jpeg.Baseline.Lossless, PixelTypes.Rgba32)]
+ public void ThrowsNotSupported_WithUnsupportedJpegs(TestImageProvider provider)
+ where TPixel : unmanaged, IPixel
+ {
+ Assert.Throws(() =>
+ {
+ using Image image = provider.GetImage(JpegDecoder);
+ });
+ }
+
// https://github.com/SixLabors/ImageSharp/pull/1732
[Theory]
[WithFile(TestImages.Jpeg.Issues.WrongColorSpace, PixelTypes.Rgba32)]
public void Issue1732_DecodesWithRgbColorSpace(TestImageProvider provider)
where TPixel : unmanaged, IPixel
{
- using (Image image = provider.GetImage(new JpegDecoder()))
+ using (Image image = provider.GetImage(JpegDecoder))
{
image.DebugSave(provider);
image.CompareToOriginal(provider);
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs
index 8e12b04be..2bd2961de 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs
@@ -24,6 +24,10 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[Trait("Format", "Jpg")]
public class JpegEncoderTests
{
+ private static JpegEncoder JpegEncoder => new JpegEncoder();
+
+ private static JpegDecoder JpegDecoder => new JpegDecoder();
+
public static readonly TheoryData QualityFiles =
new TheoryData
{
@@ -31,15 +35,18 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
{ TestImages.Jpeg.Progressive.Fb, 75 }
};
- public static readonly TheoryData BitsPerPixel_Quality =
- new TheoryData
+ public static readonly TheoryData BitsPerPixel_Quality =
+ new TheoryData
{
- { JpegSubsample.Ratio420, 40 },
- { JpegSubsample.Ratio420, 60 },
- { JpegSubsample.Ratio420, 100 },
- { JpegSubsample.Ratio444, 40 },
- { JpegSubsample.Ratio444, 60 },
- { JpegSubsample.Ratio444, 100 },
+ { JpegColorType.YCbCrRatio420, 40 },
+ { JpegColorType.YCbCrRatio420, 60 },
+ { JpegColorType.YCbCrRatio420, 100 },
+ { JpegColorType.YCbCrRatio444, 40 },
+ { JpegColorType.YCbCrRatio444, 60 },
+ { JpegColorType.YCbCrRatio444, 100 },
+ { JpegColorType.Rgb, 40 },
+ { JpegColorType.Rgb, 60 },
+ { JpegColorType.Rgb, 100 }
};
public static readonly TheoryData Grayscale_Quality =
@@ -59,17 +66,84 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
};
[Theory]
- [MemberData(nameof(QualityFiles))]
- public void Encode_PreserveQuality(string imagePath, int quality)
+ [WithFile(TestImages.Jpeg.Baseline.Floorplan, PixelTypes.Rgba32, JpegColorType.Luminance)]
+ [WithFile(TestImages.Jpeg.Baseline.Jpeg444, PixelTypes.Rgba32, JpegColorType.YCbCrRatio444)]
+ [WithFile(TestImages.Jpeg.Baseline.Jpeg420Small, PixelTypes.Rgba32, JpegColorType.YCbCrRatio420)]
+ [WithFile(TestImages.Jpeg.Baseline.JpegRgb, PixelTypes.Rgba32, JpegColorType.Rgb)]
+ public void Encode_PreservesColorType(TestImageProvider provider, JpegColorType expectedColorType)
+ where TPixel : unmanaged, IPixel
+ {
+ // arrange
+ using Image input = provider.GetImage(JpegDecoder);
+ using var memoryStream = new MemoryStream();
+
+ // act
+ input.Save(memoryStream, JpegEncoder);
+
+ // assert
+ memoryStream.Position = 0;
+ using var output = Image.Load(memoryStream);
+ JpegMetadata meta = output.Metadata.GetJpegMetadata();
+ Assert.Equal(expectedColorType, meta.ColorType);
+ }
+
+ [Theory]
+ [WithFile(TestImages.Jpeg.Baseline.Cmyk, PixelTypes.Rgba32)]
+ [WithFile(TestImages.Jpeg.Baseline.Jpeg410, PixelTypes.Rgba32)]
+ [WithFile(TestImages.Jpeg.Baseline.Jpeg411, PixelTypes.Rgba32)]
+ [WithFile(TestImages.Jpeg.Baseline.Jpeg422, PixelTypes.Rgba32)]
+ public void Encode_WithUnsupportedColorType_FromInputImage_DefaultsToYCbCr420(TestImageProvider provider)
+ where TPixel : unmanaged, IPixel
+ {
+ // arrange
+ using Image input = provider.GetImage(JpegDecoder);
+ using var memoryStream = new MemoryStream();
+
+ // act
+ input.Save(memoryStream, new JpegEncoder()
+ {
+ Quality = 75
+ });
+
+ // assert
+ memoryStream.Position = 0;
+ using var output = Image.Load(memoryStream);
+ JpegMetadata meta = output.Metadata.GetJpegMetadata();
+ Assert.Equal(JpegColorType.YCbCrRatio420, meta.ColorType);
+ }
+
+ [Theory]
+ [InlineData(JpegColorType.Cmyk)]
+ [InlineData(JpegColorType.YCbCrRatio410)]
+ [InlineData(JpegColorType.YCbCrRatio411)]
+ [InlineData(JpegColorType.YCbCrRatio422)]
+ public void Encode_WithUnsupportedColorType_DefaultsToYCbCr420(JpegColorType colorType)
{
- var options = new JpegEncoder();
+ // arrange
+ var jpegEncoder = new JpegEncoder() { ColorType = colorType };
+ using var input = new Image(10, 10);
+ using var memoryStream = new MemoryStream();
+
+ // act
+ input.Save(memoryStream, jpegEncoder);
+ // assert
+ memoryStream.Position = 0;
+ using var output = Image.Load(memoryStream);
+ JpegMetadata meta = output.Metadata.GetJpegMetadata();
+ Assert.Equal(JpegColorType.YCbCrRatio420, meta.ColorType);
+ }
+
+ [Theory]
+ [MemberData(nameof(QualityFiles))]
+ public void Encode_PreservesQuality(string imagePath, int quality)
+ {
var testFile = TestFile.Create(imagePath);
using (Image input = testFile.CreateRgba32Image())
{
using (var memStream = new MemoryStream())
{
- input.Save(memStream, options);
+ input.Save(memStream, JpegEncoder);
memStream.Position = 0;
using (var output = Image.Load(memStream))
@@ -83,16 +157,30 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[Theory]
[WithFile(TestImages.Png.CalliphoraPartial, nameof(BitsPerPixel_Quality), PixelTypes.Rgba32)]
+ public void EncodeBaseline_CalliphoraPartial(TestImageProvider provider, JpegColorType colorType, int quality)
+ where TPixel : unmanaged, IPixel => TestJpegEncoderCore(provider, colorType, quality);
+
+ [Theory]
+ [WithFile(TestImages.Png.CalliphoraPartial, nameof(BitsPerPixel_Quality), PixelTypes.Rgba32)]
+ [WithTestPatternImages(nameof(BitsPerPixel_Quality), 158, 24, PixelTypes.Rgba32)]
+ [WithTestPatternImages(nameof(BitsPerPixel_Quality), 153, 21, PixelTypes.Rgba32)]
+ [WithTestPatternImages(nameof(BitsPerPixel_Quality), 600, 400, PixelTypes.Rgba32)]
+ [WithTestPatternImages(nameof(BitsPerPixel_Quality), 138, 24, PixelTypes.Rgba32)]
+ public void EncodeBaseline_WorksWithDifferentSizes(TestImageProvider provider, JpegColorType colorType, int quality)
+ where TPixel : unmanaged, IPixel => TestJpegEncoderCore(provider, colorType, quality);
+
+ [Theory]
+ [WithSolidFilledImages(nameof(BitsPerPixel_Quality), 1, 1, 100, 100, 100, 255, PixelTypes.L8)]
+ [WithSolidFilledImages(nameof(BitsPerPixel_Quality), 1, 1, 255, 100, 50, 255, PixelTypes.Rgba32)]
+ [WithTestPatternImages(nameof(BitsPerPixel_Quality), 143, 81, PixelTypes.Rgba32)]
+ [WithTestPatternImages(nameof(BitsPerPixel_Quality), 7, 5, PixelTypes.Rgba32)]
+ [WithTestPatternImages(nameof(BitsPerPixel_Quality), 96, 48, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 73, 71, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 48, 24, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 46, 8, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 51, 7, PixelTypes.Rgba32)]
- [WithSolidFilledImages(nameof(BitsPerPixel_Quality), 1, 1, 255, 100, 50, 255, PixelTypes.Rgba32)]
- [WithTestPatternImages(nameof(BitsPerPixel_Quality), 7, 5, PixelTypes.Rgba32)]
- [WithTestPatternImages(nameof(BitsPerPixel_Quality), 600, 400, PixelTypes.Rgba32)]
- [WithSolidFilledImages(nameof(BitsPerPixel_Quality), 1, 1, 100, 100, 100, 255, PixelTypes.L8)]
- public void EncodeBaseline_WorksWithDifferentSizes(TestImageProvider provider, JpegSubsample subsample, int quality)
- where TPixel : unmanaged, IPixel => TestJpegEncoderCore(provider, subsample, quality);
+ public void EncodeBaseline_WithSmallImages_WorksWithDifferentSizes(TestImageProvider provider, JpegColorType colorType, int quality)
+ where TPixel : unmanaged, IPixel => TestJpegEncoderCore(provider, colorType, quality, comparer: ImageComparer.Tolerant(0.12f));
[Theory]
[WithFile(TestImages.Png.BikeGrayscale, nameof(Grayscale_Quality), PixelTypes.L8)]
@@ -102,46 +190,51 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[WithSolidFilledImages(1, 1, 100, 100, 100, 255, PixelTypes.La16, 100)]
[WithSolidFilledImages(1, 1, 100, 100, 100, 255, PixelTypes.La32, 100)]
public void EncodeBaseline_Grayscale(TestImageProvider provider, int quality)
- where TPixel : unmanaged, IPixel => TestJpegEncoderCore(provider, null, quality, JpegColorType.Luminance);
+ where TPixel : unmanaged, IPixel => TestJpegEncoderCore(provider, JpegColorType.Luminance, quality);
+
+ [Theory]
+ [WithTestPatternImages(nameof(BitsPerPixel_Quality), 96, 96, PixelTypes.Rgba32 | PixelTypes.Bgra32)]
+ public void EncodeBaseline_IsNotBoundToSinglePixelType(TestImageProvider provider, JpegColorType colorType, int quality)
+ where TPixel : unmanaged, IPixel => TestJpegEncoderCore(provider, colorType, quality);
[Theory]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 48, 48, PixelTypes.Rgba32 | PixelTypes.Bgra32)]
- public void EncodeBaseline_IsNotBoundToSinglePixelType(TestImageProvider provider, JpegSubsample subsample, int quality)
- where TPixel : unmanaged, IPixel => TestJpegEncoderCore(provider, subsample, quality);
+ public void EncodeBaseline_WithSmallImages_IsNotBoundToSinglePixelType(TestImageProvider provider, JpegColorType colorType, int quality)
+ where TPixel : unmanaged, IPixel => TestJpegEncoderCore(provider, colorType, quality, comparer: ImageComparer.Tolerant(0.06f));
[Theory]
- [WithFile(TestImages.Png.CalliphoraPartial, PixelTypes.Rgba32, JpegSubsample.Ratio444)]
- [WithTestPatternImages(587, 821, PixelTypes.Rgba32, JpegSubsample.Ratio444)]
- [WithTestPatternImages(677, 683, PixelTypes.Bgra32, JpegSubsample.Ratio420)]
- [WithSolidFilledImages(400, 400, "Red", PixelTypes.Bgr24, JpegSubsample.Ratio420)]
- public void EncodeBaseline_WorksWithDiscontiguousBuffers(TestImageProvider provider, JpegSubsample subsample)
+ [WithFile(TestImages.Png.CalliphoraPartial, PixelTypes.Rgba32, JpegColorType.YCbCrRatio444)]
+ [WithTestPatternImages(587, 821, PixelTypes.Rgba32, JpegColorType.YCbCrRatio444)]
+ [WithTestPatternImages(677, 683, PixelTypes.Bgra32, JpegColorType.YCbCrRatio420)]
+ [WithSolidFilledImages(400, 400, "Red", PixelTypes.Bgr24, JpegColorType.YCbCrRatio420)]
+ public void EncodeBaseline_WorksWithDiscontiguousBuffers(TestImageProvider provider, JpegColorType colorType)
where TPixel : unmanaged, IPixel
{
- ImageComparer comparer = subsample == JpegSubsample.Ratio444
+ ImageComparer comparer = colorType == JpegColorType.YCbCrRatio444
? ImageComparer.TolerantPercentage(0.1f)
: ImageComparer.TolerantPercentage(5f);
provider.LimitAllocatorBufferCapacity().InBytesSqrt(200);
- TestJpegEncoderCore(provider, subsample, 100, JpegColorType.YCbCr, comparer);
+ TestJpegEncoderCore(provider, colorType, 100, comparer);
}
///
/// Anton's SUPER-SCIENTIFIC tolerance threshold calculation
///
- private static ImageComparer GetComparer(int quality, JpegSubsample? subsample)
+ private static ImageComparer GetComparer(int quality, JpegColorType? colorType)
{
float tolerance = 0.015f; // ~1.5%
if (quality < 50)
{
- tolerance *= 10f;
+ tolerance *= 4.5f;
}
- else if (quality < 75 || subsample == JpegSubsample.Ratio420)
+ else if (quality < 75 || colorType == JpegColorType.YCbCrRatio420)
{
- tolerance *= 5f;
- if (subsample == JpegSubsample.Ratio420)
+ tolerance *= 2.0f;
+ if (colorType == JpegColorType.YCbCrRatio420)
{
- tolerance *= 2f;
+ tolerance *= 2.0f;
}
}
@@ -150,9 +243,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
private static void TestJpegEncoderCore(
TestImageProvider provider,
- JpegSubsample? subsample,
+ JpegColorType colorType = JpegColorType.YCbCrRatio420,
int quality = 100,
- JpegColorType colorType = JpegColorType.YCbCr,
ImageComparer comparer = null)
where TPixel : unmanaged, IPixel
{
@@ -163,13 +255,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
var encoder = new JpegEncoder
{
- Subsample = subsample,
Quality = quality,
ColorType = colorType
};
- string info = $"{subsample}-Q{quality}";
+ string info = $"{colorType}-Q{quality}";
- comparer ??= GetComparer(quality, subsample);
+ comparer ??= GetComparer(quality, colorType);
// Does DebugSave & load reference CompareToReferenceInput():
image.VerifyEncoder(provider, "jpeg", info, encoder, comparer, referenceImageExtension: "png");
@@ -225,14 +316,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[MemberData(nameof(RatioFiles))]
public void Encode_PreserveRatio(string imagePath, int xResolution, int yResolution, PixelResolutionUnit resolutionUnit)
{
- var options = new JpegEncoder();
-
var testFile = TestFile.Create(imagePath);
using (Image input = testFile.CreateRgba32Image())
{
using (var memStream = new MemoryStream())
{
- input.Save(memStream, options);
+ input.Save(memStream, JpegEncoder);
memStream.Position = 0;
using (var output = Image.Load(memStream))
@@ -253,11 +342,10 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
using var input = new Image(1, 1);
input.Metadata.IptcProfile = new IptcProfile();
input.Metadata.IptcProfile.SetValue(IptcTag.Byline, "unit_test");
- var encoder = new JpegEncoder();
// act
using var memStream = new MemoryStream();
- input.Save(memStream, encoder);
+ input.Save(memStream, JpegEncoder);
// assert
memStream.Position = 0;
@@ -275,11 +363,10 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
using var input = new Image(1, 1);
input.Metadata.ExifProfile = new ExifProfile();
input.Metadata.ExifProfile.SetValue(ExifTag.Software, "unit_test");
- var encoder = new JpegEncoder();
// act
using var memStream = new MemoryStream();
- input.Save(memStream, encoder);
+ input.Save(memStream, JpegEncoder);
// assert
memStream.Position = 0;
@@ -296,11 +383,10 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
// arrange
using var input = new Image(1, 1);
input.Metadata.IccProfile = new IccProfile(IccTestDataProfiles.Profile_Random_Array);
- var encoder = new JpegEncoder();
// act
using var memStream = new MemoryStream();
- input.Save(memStream, encoder);
+ input.Save(memStream, JpegEncoder);
// assert
memStream.Position = 0;
@@ -312,9 +398,9 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
}
[Theory]
- [InlineData(JpegSubsample.Ratio420)]
- [InlineData(JpegSubsample.Ratio444)]
- public async Task Encode_IsCancellable(JpegSubsample subsample)
+ [InlineData(JpegColorType.YCbCrRatio420)]
+ [InlineData(JpegColorType.YCbCrRatio444)]
+ public async Task Encode_IsCancellable(JpegColorType colorType)
{
var cts = new CancellationTokenSource();
using var pausedStream = new PausedStream(new MemoryStream());
@@ -336,7 +422,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
using var image = new Image(5000, 5000);
await Assert.ThrowsAsync(async () =>
{
- var encoder = new JpegEncoder() { Subsample = subsample };
+ var encoder = new JpegEncoder() { ColorType = colorType };
await image.SaveAsync(pausedStream, encoder, cts.Token);
});
}
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs
index 56bf207b9..3f045dd1a 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs
@@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
var clone = (JpegMetadata)meta.DeepClone();
clone.Quality = 99;
- clone.ColorType = JpegColorType.YCbCr;
+ clone.ColorType = JpegColorType.YCbCrRatio420;
Assert.False(meta.Quality.Equals(clone.Quality));
Assert.False(meta.ColorType.Equals(clone.ColorType));
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs
index 40b9e6867..1785f3dec 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs
@@ -21,10 +21,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[Trait("Format", "Jpg")]
public class SpectralJpegTests
{
- public SpectralJpegTests(ITestOutputHelper output)
- {
- this.Output = output;
- }
+ public SpectralJpegTests(ITestOutputHelper output) => this.Output = output;
private ITestOutputHelper Output { get; }
@@ -46,7 +43,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public static readonly string[] AllTestJpegs = BaselineTestJpegs.Concat(ProgressiveTestJpegs).ToArray();
[Theory(Skip = "Debug only, enable manually!")]
- //[Theory]
[WithFileCollection(nameof(AllTestJpegs), PixelTypes.Rgba32)]
public void Decoder_ParseStream_SaveSpectralResult(TestImageProvider provider)
where TPixel : unmanaged, IPixel
diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs
index c93a2018d..ff7025b50 100644
--- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs
@@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.Compression
using var decompressor = new DeflateTiffCompression(Configuration.Default.MemoryAllocator, 10, 8, TiffColorType.BlackIsZero8, TiffPredictor.None, false);
- decompressor.Decompress(stream, 0, (uint)stream.Length, buffer);
+ decompressor.Decompress(stream, 0, (uint)stream.Length, 1, buffer);
Assert.Equal(data, buffer);
}
diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs
index 5ea75d9a8..08705738f 100644
--- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs
@@ -40,7 +40,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.Compression
var buffer = new byte[data.Length];
using var decompressor = new LzwTiffCompression(Configuration.Default.MemoryAllocator, 10, 8, TiffColorType.BlackIsZero8, TiffPredictor.None, false);
- decompressor.Decompress(stream, 0, (uint)stream.Length, buffer);
+ decompressor.Decompress(stream, 0, (uint)stream.Length, 1, buffer);
Assert.Equal(data, buffer);
}
diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs
index 82ecb315b..d153e1ed2 100644
--- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs
@@ -17,10 +17,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.Compression
[InlineData(new byte[] { 10, 15, 20, 25, 30, 35, 40, 45 }, 5, new byte[] { 10, 15, 20, 25, 30 })]
public void Decompress_ReadsData(byte[] inputData, uint byteCount, byte[] expectedResult)
{
- var stream = new BufferedReadStream(Configuration.Default, new MemoryStream(inputData));
- var buffer = new byte[expectedResult.Length];
+ using var memoryStream = new MemoryStream(inputData);
+ using var stream = new BufferedReadStream(Configuration.Default, memoryStream);
+ byte[] buffer = new byte[expectedResult.Length];
- new NoneTiffCompression(default, default, default).Decompress(stream, 0, byteCount, buffer);
+ using var decompressor = new NoneTiffCompression(default, default, default);
+ decompressor.Decompress(stream, 0, byteCount, 1, buffer);
Assert.Equal(expectedResult, buffer);
}
diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs
index b67cb8325..b56c1e7c9 100644
--- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs
@@ -26,11 +26,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.Compression
[InlineData(new byte[] { 0xFE, 0xAA, 0x02, 0x80, 0x00, 0x2A, 0xFD, 0xAA, 0x03, 0x80, 0x00, 0x2A, 0x22, 0xF7, 0xAA }, new byte[] { 0xAA, 0xAA, 0xAA, 0x80, 0x00, 0x2A, 0xAA, 0xAA, 0xAA, 0xAA, 0x80, 0x00, 0x2A, 0x22, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA })] // Apple PackBits sample
public void Decompress_ReadsData(byte[] inputData, byte[] expectedResult)
{
- var stream = new BufferedReadStream(Configuration.Default, new MemoryStream(inputData));
- var buffer = new byte[expectedResult.Length];
+ using var memoryStream = new MemoryStream(inputData);
+ using var stream = new BufferedReadStream(Configuration.Default, memoryStream);
+ byte[] buffer = new byte[expectedResult.Length];
using var decompressor = new PackBitsTiffCompression(new ArrayPoolMemoryAllocator(), default, default);
- decompressor.Decompress(stream, 0, (uint)inputData.Length, buffer);
+ decompressor.Decompress(stream, 0, (uint)inputData.Length, 1, buffer);
Assert.Equal(expectedResult, buffer);
}
@@ -41,7 +42,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.Compression
{
// arrange
Span input = inputData.AsSpan();
- var compressed = new byte[expectedResult.Length];
+ byte[] compressed = new byte[expectedResult.Length];
// act
PackBitsWriter.PackBits(input, compressed);
diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
index 5a0495e0a..b64d22991 100644
--- a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
@@ -23,21 +23,21 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
{
public static readonly string[] MultiframeTestImages = Multiframes;
- public static readonly string[] NotSupportedImages = NotSupported;
-
private static TiffDecoder TiffDecoder => new TiffDecoder();
private static MagickReferenceDecoder ReferenceDecoder => new MagickReferenceDecoder();
[Theory]
- [WithFileCollection(nameof(NotSupportedImages), PixelTypes.Rgba32)]
+ [WithFile(RgbUncompressedTiled, PixelTypes.Rgba32)]
+ [WithFile(MultiframeDifferentSize, PixelTypes.Rgba32)]
+ [WithFile(MultiframeDifferentVariants, PixelTypes.Rgba32)]
public void ThrowsNotSupported(TestImageProvider provider)
where TPixel : unmanaged, IPixel => Assert.Throws(() => provider.GetImage(TiffDecoder));
[Theory]
[InlineData(RgbUncompressed, 24, 256, 256, 300, 300, PixelResolutionUnit.PixelsPerInch)]
[InlineData(SmallRgbDeflate, 24, 32, 32, 96, 96, PixelResolutionUnit.PixelsPerInch)]
- [InlineData(Calliphora_GrayscaleUncompressed, 8, 804, 1198, 96, 96, PixelResolutionUnit.PixelsPerInch)]
+ [InlineData(Calliphora_GrayscaleUncompressed, 8, 200, 298, 96, 96, PixelResolutionUnit.PixelsPerInch)]
[InlineData(Flower4BitPalette, 4, 73, 43, 72, 72, PixelResolutionUnit.PixelsPerInch)]
public void Identify(string imagePath, int expectedPixelSize, int expectedWidth, int expectedHeight, double expectedHResolution, double expectedVResolution, PixelResolutionUnit expectedResolutionUnit)
{
@@ -356,6 +356,13 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
public void TiffDecoder_CanDecode_Fax3Compressed(TestImageProvider provider)
where TPixel : unmanaged, IPixel => TestTiffDecoder(provider);
+ [Theory]
+ [WithFile(Fax4Compressed, PixelTypes.Rgba32)]
+ [WithFile(Fax4CompressedLowerOrderBitsFirst, PixelTypes.Rgba32)]
+ [WithFile(Calliphora_Fax4Compressed, PixelTypes.Rgba32)]
+ public void TiffDecoder_CanDecode_Fax4Compressed(TestImageProvider provider)
+ where TPixel : unmanaged, IPixel => TestTiffDecoder(provider);
+
[Theory]
[WithFile(CcittFax3LowerOrderBitsFirst, PixelTypes.Rgba32)]
public void TiffDecoder_CanDecode_Compressed_LowerOrderBitsFirst(TestImageProvider provider)
@@ -368,6 +375,14 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
public void TiffDecoder_CanDecode_PackBitsCompressed(TestImageProvider provider)
where TPixel : unmanaged, IPixel => TestTiffDecoder(provider);
+ [Theory]
+ [WithFile(RgbJpegCompressed, PixelTypes.Rgba32)]
+ [WithFile(RgbWithStripsJpegCompressed, PixelTypes.Rgba32)]
+ [WithFile(YCbCrJpegCompressed, PixelTypes.Rgba32)]
+ [WithFile(RgbJpegCompressedNoJpegTable, PixelTypes.Rgba32)]
+ public void TiffDecoder_CanDecode_JpegCompressed(TestImageProvider provider)
+ where TPixel : unmanaged, IPixel => TestTiffDecoder(provider, useExactComparer: false);
+
[Theory]
[WithFileCollection(nameof(MultiframeTestImages), PixelTypes.Rgba32)]
public void DecodeMultiframe(TestImageProvider provider)
diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs
index 712c8502a..d7333c0b5 100644
--- a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs
@@ -114,7 +114,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
[InlineData(TiffPhotometricInterpretation.BlackIsZero, TiffCompression.Ccitt1D, TiffBitsPerPixel.Bit1, TiffCompression.Ccitt1D)]
[InlineData(TiffPhotometricInterpretation.Rgb, TiffCompression.ItuTRecT43, TiffBitsPerPixel.Bit24, TiffCompression.None)]
[InlineData(TiffPhotometricInterpretation.Rgb, TiffCompression.ItuTRecT82, TiffBitsPerPixel.Bit24, TiffCompression.None)]
- [InlineData(TiffPhotometricInterpretation.Rgb, TiffCompression.Jpeg, TiffBitsPerPixel.Bit24, TiffCompression.None)]
+ [InlineData(TiffPhotometricInterpretation.Rgb, TiffCompression.Jpeg, TiffBitsPerPixel.Bit24, TiffCompression.Jpeg)]
[InlineData(TiffPhotometricInterpretation.Rgb, TiffCompression.OldDeflate, TiffBitsPerPixel.Bit24, TiffCompression.None)]
[InlineData(TiffPhotometricInterpretation.Rgb, TiffCompression.OldJpeg, TiffBitsPerPixel.Bit24, TiffCompression.None)]
public void EncoderOptions_SetPhotometricInterpretationAndCompression_Works(
@@ -288,6 +288,11 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
public void TiffEncoder_EncodeRgb_WithPackBitsCompression_Works(TestImageProvider provider)
where TPixel : unmanaged, IPixel => TestTiffEncoderCore(provider, TiffBitsPerPixel.Bit24, TiffPhotometricInterpretation.Rgb, TiffCompression.PackBits);
+ [Theory]
+ [WithFile(Calliphora_RgbUncompressed, PixelTypes.Rgba32)]
+ public void TiffEncoder_EncodeRgb_WithJpegCompression_Works(TestImageProvider provider)
+ where TPixel : unmanaged, IPixel => TestTiffEncoderCore(provider, TiffBitsPerPixel.Bit24, TiffPhotometricInterpretation.Rgb, TiffCompression.Jpeg, useExactComparer: false, compareTolerance: 0.012f);
+
[Theory]
[WithFile(Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)]
public void TiffEncoder_EncodeGray_Works(TestImageProvider provider)
diff --git a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
index 30bd544fa..471287006 100644
--- a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
+++ b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
@@ -10,6 +10,11 @@
+
+
+ net6.0;net5.0;netcoreapp3.1;netcoreapp2.1;net472
+
+
netcoreapp3.1
@@ -21,7 +26,7 @@
-
+
diff --git a/tests/ImageSharp.Tests/Memory/Allocators/ArrayPoolMemoryAllocatorTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/ArrayPoolMemoryAllocatorTests.cs
index 7620d63de..dd53b0b56 100644
--- a/tests/ImageSharp.Tests/Memory/Allocators/ArrayPoolMemoryAllocatorTests.cs
+++ b/tests/ImageSharp.Tests/Memory/Allocators/ArrayPoolMemoryAllocatorTests.cs
@@ -114,6 +114,23 @@ namespace SixLabors.ImageSharp.Tests.Memory.Allocators
}
}
+ [Fact]
+ public unsafe void Allocate_MemoryIsPinnableMultipleTimes()
+ {
+ ArrayPoolMemoryAllocator allocator = this.LocalFixture.MemoryAllocator;
+ using IMemoryOwner memoryOwner = allocator.Allocate(100);
+
+ using (MemoryHandle pin = memoryOwner.Memory.Pin())
+ {
+ Assert.NotEqual(IntPtr.Zero, (IntPtr)pin.Pointer);
+ }
+
+ using (MemoryHandle pin = memoryOwner.Memory.Pin())
+ {
+ Assert.NotEqual(IntPtr.Zero, (IntPtr)pin.Pointer);
+ }
+ }
+
[Theory]
[InlineData(false)]
[InlineData(true)]
diff --git a/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs
index 8e7b30567..0e1f99725 100644
--- a/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs
+++ b/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
+using System.Buffers;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using Xunit;
@@ -36,9 +37,26 @@ namespace SixLabors.ImageSharp.Tests.Memory.Allocators
Assert.Equal("length", ex.ParamName);
}
+ [Fact]
+ public unsafe void Allocate_MemoryIsPinnableMultipleTimes()
+ {
+ SimpleGcMemoryAllocator allocator = this.MemoryAllocator;
+ using IMemoryOwner memoryOwner = allocator.Allocate(100);
+
+ using (MemoryHandle pin = memoryOwner.Memory.Pin())
+ {
+ Assert.NotEqual(IntPtr.Zero, (IntPtr)pin.Pointer);
+ }
+
+ using (MemoryHandle pin = memoryOwner.Memory.Pin())
+ {
+ Assert.NotEqual(IntPtr.Zero, (IntPtr)pin.Pointer);
+ }
+ }
+
[StructLayout(LayoutKind.Explicit, Size = 512)]
private struct BigStruct
{
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/ImageSharp.Tests/ProfilingBenchmarks/JpegProfilingBenchmarks.cs b/tests/ImageSharp.Tests/ProfilingBenchmarks/JpegProfilingBenchmarks.cs
index 9de3fc8df..4a47ac236 100644
--- a/tests/ImageSharp.Tests/ProfilingBenchmarks/JpegProfilingBenchmarks.cs
+++ b/tests/ImageSharp.Tests/ProfilingBenchmarks/JpegProfilingBenchmarks.cs
@@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.Tests.ProfilingBenchmarks
img.Dispose();
},
#pragma warning disable SA1515 // Single-line comment should be preceded by blank line
- // ReSharper disable once ExplicitCallerInfoArgument
+ // ReSharper disable once ExplicitCallerInfoArgument
$"Decode {fileName}");
#pragma warning restore SA1515 // Single-line comment should be preceded by blank line
}
@@ -92,11 +92,11 @@ namespace SixLabors.ImageSharp.Tests.ProfilingBenchmarks
// Benchmark, enable manually!
[Theory(Skip = ProfilingSetup.SkipProfilingTests)]
- [InlineData(1, 75, JpegSubsample.Ratio420)]
- [InlineData(30, 75, JpegSubsample.Ratio420)]
- [InlineData(30, 75, JpegSubsample.Ratio444)]
- [InlineData(30, 100, JpegSubsample.Ratio444)]
- public void EncodeJpeg(int executionCount, int quality, JpegSubsample subsample)
+ [InlineData(1, 75, JpegColorType.YCbCrRatio420)]
+ [InlineData(30, 75, JpegColorType.YCbCrRatio420)]
+ [InlineData(30, 75, JpegColorType.YCbCrRatio444)]
+ [InlineData(30, 100, JpegColorType.YCbCrRatio444)]
+ public void EncodeJpeg(int executionCount, int quality, JpegColorType colorType)
{
// do not run this on CI even by accident
if (TestEnvironment.RunsOnCI)
@@ -118,7 +118,7 @@ namespace SixLabors.ImageSharp.Tests.ProfilingBenchmarks
{
foreach (Image img in testImages)
{
- var options = new JpegEncoder { Quality = quality, Subsample = subsample };
+ var options = new JpegEncoder { Quality = quality, ColorType = colorType };
img.Save(ms, options);
ms.Seek(0, SeekOrigin.Begin);
}
diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs
index 1e12bb66a..d1a6624af 100644
--- a/tests/ImageSharp.Tests/TestImages.cs
+++ b/tests/ImageSharp.Tests/TestImages.cs
@@ -190,6 +190,10 @@ namespace SixLabors.ImageSharp.Tests
public const string Jpeg420Exif = "Jpg/baseline/jpeg420exif.jpg";
public const string Jpeg444 = "Jpg/baseline/jpeg444.jpg";
public const string Jpeg420Small = "Jpg/baseline/jpeg420small.jpg";
+ public const string JpegRgb = "Jpg/baseline/jpeg-rgb.jpg";
+ public const string Jpeg410 = "Jpg/baseline/jpeg410.jpg";
+ public const string Jpeg411 = "Jpg/baseline/jpeg411.jpg";
+ public const string Jpeg422 = "Jpg/baseline/jpeg422.jpg";
public const string Testorig420 = "Jpg/baseline/testorig.jpg";
public const string MultiScanBaselineCMYK = "Jpg/baseline/MultiScanBaselineCMYK.jpg";
public const string Ratio1x1 = "Jpg/baseline/ratio-1x1.jpg";
@@ -200,6 +204,9 @@ namespace SixLabors.ImageSharp.Tests
public const string App13WithEmptyIptc = "Jpg/baseline/iptc-psAPP13-wIPTCempty.jpg";
public const string HistogramEqImage = "Jpg/baseline/640px-Unequalized_Hawkes_Bay_NZ.jpg";
public const string ForestBridgeDifferentComponentsQuality = "Jpg/baseline/forest_bridge.jpg";
+ public const string ArithmeticCoding = "Jpg/baseline/arithmetic_coding.jpg";
+ public const string ArithmeticCodingProgressive = "Jpg/progressive/arithmetic_progressive.jpg";
+ public const string Lossless = "Jpg/baseline/lossless.jpg";
public static readonly string[] All =
{
@@ -535,6 +542,8 @@ namespace SixLabors.ImageSharp.Tests
public const string Calliphora_Fax4Compressed = "Tiff/Calliphora_ccitt_fax4.tiff";
public const string Calliphora_HuffmanCompressed = "Tiff/Calliphora_huffman_rle.tiff";
public const string Calliphora_BiColorUncompressed = "Tiff/Calliphora_bicolor_uncompressed.tiff";
+ public const string Fax4Compressed = "Tiff/basi3p02_fax4.tiff";
+ public const string Fax4CompressedLowerOrderBitsFirst = "Tiff/basi3p02_fax4_lowerOrderBitsFirst.tiff";
public const string CcittFax3AllTermCodes = "Tiff/ccitt_fax3_all_terminating_codes.tiff";
public const string CcittFax3AllMakeupCodes = "Tiff/ccitt_fax3_all_makeup_codes.tiff";
@@ -553,7 +562,9 @@ namespace SixLabors.ImageSharp.Tests
public const string RgbDeflate = "Tiff/rgb_deflate.tiff";
public const string RgbDeflatePredictor = "Tiff/rgb_deflate_predictor.tiff";
public const string RgbDeflateMultistrip = "Tiff/rgb_deflate_multistrip.tiff";
- public const string RgbJpeg = "Tiff/rgb_jpeg.tiff";
+ public const string RgbJpegCompressed = "Tiff/rgb_jpegcompression.tiff";
+ public const string RgbWithStripsJpegCompressed = "Tiff/rgb_jpegcompressed_stripped.tiff";
+ public const string RgbJpegCompressedNoJpegTable = "Tiff/rgb_jpegcompressed_nojpegtable.tiff";
public const string RgbLzwPredictor = "Tiff/rgb_lzw_predictor.tiff";
public const string RgbLzwNoPredictor = "Tiff/rgb_lzw_no_predictor.tiff";
public const string RgbLzwNoPredictorMultistrip = "Tiff/rgb_lzw_noPredictor_multistrip.tiff";
@@ -601,6 +612,7 @@ namespace SixLabors.ImageSharp.Tests
public const string RgbYCbCr888Contiguoush2v1 = "Tiff/rgb-ycbcr-contig-08_h2v1.tiff";
public const string RgbYCbCr888Contiguoush2v2 = "Tiff/rgb-ycbcr-contig-08_h2v2.tiff";
public const string RgbYCbCr888Contiguoush4v4 = "Tiff/rgb-ycbcr-contig-08_h4v4.tiff";
+ public const string YCbCrJpegCompressed = "Tiff/ycbcr_jpegcompressed.tiff";
public const string FlowerRgb444Contiguous = "Tiff/flower-rgb-contig-04.tiff";
public const string FlowerRgb444Planar = "Tiff/flower-rgb-planar-04.tiff";
public const string FlowerRgb222Contiguous = "Tiff/flower-rgb-contig-02.tiff";
@@ -659,8 +671,6 @@ namespace SixLabors.ImageSharp.Tests
public static readonly string[] Multiframes = { MultiframeDeflateWithPreview, MultiframeLzwPredictor /*, MultiFrameDifferentSize, MultiframeDifferentSizeTiled, MultiFrameDifferentVariants,*/ };
public static readonly string[] Metadata = { SampleMetadata };
-
- public static readonly string[] NotSupported = { Calliphora_RgbJpeg, RgbJpeg, RgbUncompressedTiled, MultiframeDifferentSize, MultiframeDifferentVariants, Calliphora_Fax4Compressed, Fax4_Motorola };
}
}
}
diff --git a/tests/Images/Input/Jpg/baseline/arithmetic_coding.jpg b/tests/Images/Input/Jpg/baseline/arithmetic_coding.jpg
new file mode 100644
index 000000000..3f57b7d7a
--- /dev/null
+++ b/tests/Images/Input/Jpg/baseline/arithmetic_coding.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fec7012d9ae52a12c4617fd7526e506feee812fc67e923a76b2ca88c95f7a538
+size 3111
diff --git a/tests/Images/Input/Jpg/baseline/jpeg-rgb.jpg b/tests/Images/Input/Jpg/baseline/jpeg-rgb.jpg
new file mode 100644
index 000000000..2f2be0fa1
--- /dev/null
+++ b/tests/Images/Input/Jpg/baseline/jpeg-rgb.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f4630c33d722a89de5cb1834bffa43c729f204c0f8c95d4ec2127ddfcd433f60
+size 10100
diff --git a/tests/Images/Input/Jpg/baseline/jpeg410.jpg b/tests/Images/Input/Jpg/baseline/jpeg410.jpg
new file mode 100644
index 000000000..3bc41af8d
--- /dev/null
+++ b/tests/Images/Input/Jpg/baseline/jpeg410.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:318338c1a541227632a99cc47b04fc9f6d19c3e8300a76e71136edec2d17a5f5
+size 9073
diff --git a/tests/Images/Input/Jpg/baseline/jpeg411.jpg b/tests/Images/Input/Jpg/baseline/jpeg411.jpg
new file mode 100644
index 000000000..43a2ba49d
--- /dev/null
+++ b/tests/Images/Input/Jpg/baseline/jpeg411.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:70315936e36bb1edf38fc950b7b321f20be5a2592db59bfd28d79dbc391a5aaf
+size 4465
diff --git a/tests/Images/Input/Jpg/baseline/jpeg422.jpg b/tests/Images/Input/Jpg/baseline/jpeg422.jpg
new file mode 100644
index 000000000..4782b53b3
--- /dev/null
+++ b/tests/Images/Input/Jpg/baseline/jpeg422.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:be21207ecb96bcb0925706649678c522c68bf08ee26e6e8878456f4f7772dd31
+size 3951
diff --git a/tests/Images/Input/Jpg/baseline/lossless.jpg b/tests/Images/Input/Jpg/baseline/lossless.jpg
new file mode 100644
index 000000000..37091b73c
--- /dev/null
+++ b/tests/Images/Input/Jpg/baseline/lossless.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8937e245885e1f280e1843ad48a4349ec1a3f71f86c954229cd44160aeeaaac4
+size 209584
diff --git a/tests/Images/Input/Jpg/progressive/arithmetic_progressive.jpg b/tests/Images/Input/Jpg/progressive/arithmetic_progressive.jpg
new file mode 100644
index 000000000..06b3b684e
--- /dev/null
+++ b/tests/Images/Input/Jpg/progressive/arithmetic_progressive.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3af237c172248d39c7b82c879de3d162e4dafaf36dc298add210740843edd33f
+size 3129
diff --git a/tests/Images/Input/Tiff/Calliphora_bicolor_uncompressed.tiff b/tests/Images/Input/Tiff/Calliphora_bicolor_uncompressed.tiff
index b0dbdde54..5b668ac51 100644
--- a/tests/Images/Input/Tiff/Calliphora_bicolor_uncompressed.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_bicolor_uncompressed.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:ed3b08730e5c34eb8d268f58d1e09efe2605398899bfd726cc3b35de21baa6ff
-size 121196
+oid sha256:c35902ca485fba441230efa88f794ee5aafa9f75ad5e4a14cb3d592a0a98c538
+size 7760
diff --git a/tests/Images/Input/Tiff/Calliphora_ccitt_fax3.tiff b/tests/Images/Input/Tiff/Calliphora_ccitt_fax3.tiff
index d2761d291..3592206bc 100644
--- a/tests/Images/Input/Tiff/Calliphora_ccitt_fax3.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_ccitt_fax3.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:bba35f1e43c8425f3bcfab682efae4d2c00c62f0d8a4b411e646d32047469526
-size 125802
+oid sha256:da7d98823c284d92982a88c4a51434bbc140dceac245a8a054c6e41a489d0cc7
+size 5986
diff --git a/tests/Images/Input/Tiff/Calliphora_ccitt_fax4.tiff b/tests/Images/Input/Tiff/Calliphora_ccitt_fax4.tiff
index 384d00eaa..e0b4fa35e 100644
--- a/tests/Images/Input/Tiff/Calliphora_ccitt_fax4.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_ccitt_fax4.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:7a2c95aec08b96bca30af344f7d9952a603a951802ce534a5f2c5f563795cbd2
-size 117704
+oid sha256:118e55fe0f0dbb5d2712337ec9456a27407f11c0eb9f7e7e81700d4d84b7db09
+size 4378
diff --git a/tests/Images/Input/Tiff/Calliphora_gray_deflate.tiff b/tests/Images/Input/Tiff/Calliphora_gray_deflate.tiff
index 621ef158a..390952120 100644
--- a/tests/Images/Input/Tiff/Calliphora_gray_deflate.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_gray_deflate.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:2314b31ca9938fa8b11cbabda0b118a90025a45d2931fca9afa131c0d6919aca
-size 557717
+oid sha256:d4d3541db6b7751d3225599aa822c3376fb27bb9dc2dd28674ef4f78bf426191
+size 83356
diff --git a/tests/Images/Input/Tiff/Calliphora_gray_deflate_predictor.tiff b/tests/Images/Input/Tiff/Calliphora_gray_deflate_predictor.tiff
index f44a6e934..e7fdef14b 100644
--- a/tests/Images/Input/Tiff/Calliphora_gray_deflate_predictor.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_gray_deflate_predictor.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:b9576b3a49b84e26938a7e9ded5f43a1a3c3390bf4824803f5aaab8e00c1afb4
-size 630947
+oid sha256:d007429701cc20154e84909af6988414001e6e60fba5c995f67b2a04cad6e57b
+size 41135
diff --git a/tests/Images/Input/Tiff/Calliphora_gray_lzw_predictor.tiff b/tests/Images/Input/Tiff/Calliphora_gray_lzw_predictor.tiff
index b14eeba8d..de8562296 100644
--- a/tests/Images/Input/Tiff/Calliphora_gray_lzw_predictor.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_gray_lzw_predictor.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:3f24fd8f36a4847fcb84a317de4fd2eacd5eb0c58ef4436d33919f0a6658d0d9
-size 698309
+oid sha256:649f0b8ad50a9465fdb447c411e33f20a8b367600e7c3af83c8f686f3ab3e6dc
+size 47143
diff --git a/tests/Images/Input/Tiff/Calliphora_grayscale_uncompressed.tiff b/tests/Images/Input/Tiff/Calliphora_grayscale_uncompressed.tiff
index 5db7ef564..e6ff007d4 100644
--- a/tests/Images/Input/Tiff/Calliphora_grayscale_uncompressed.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_grayscale_uncompressed.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:0283f2be39a151ca3ed19be97ebe4a6b17978ed251dd4d0d568895865fec24c7
-size 964588
+oid sha256:5925388b374b75161ef49273e8c85c4f99713e5e3be380ea13a03895f47809ba
+size 60001
diff --git a/tests/Images/Input/Tiff/Calliphora_huffman_rle.tiff b/tests/Images/Input/Tiff/Calliphora_huffman_rle.tiff
index e0a39d248..1998b371c 100644
--- a/tests/Images/Input/Tiff/Calliphora_huffman_rle.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_huffman_rle.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:1a4f687de9925863b1c9f32f53b6c05fb121f9d7b02ff5869113c4745433f10d
-size 124644
+oid sha256:f27e758bb72d5e03fdcf0b1c58c417e4a7928cbdf8d432dc5b9a7d8d7ee4d06b
+size 5668
diff --git a/tests/Images/Input/Tiff/Calliphora_palette_uncompressed.tiff b/tests/Images/Input/Tiff/Calliphora_palette_uncompressed.tiff
index 1592645c8..1d3c9a789 100644
--- a/tests/Images/Input/Tiff/Calliphora_palette_uncompressed.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_palette_uncompressed.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:b70500348b1af7828c15e7782eaca105ff749136d7c45eb4cab8c5cd5269c3f6
-size 966134
+oid sha256:29d4b30265158a7cc651d75130843a7f5a7ebf8b2f0f4bb0cf86c82cbec7f6ec
+size 61549
diff --git a/tests/Images/Input/Tiff/Calliphora_rgb_deflate_predictor.tiff b/tests/Images/Input/Tiff/Calliphora_rgb_deflate_predictor.tiff
index c2ebed364..0ded46140 100644
--- a/tests/Images/Input/Tiff/Calliphora_rgb_deflate_predictor.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_rgb_deflate_predictor.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:da6e6a35a0bb0f5f2d49e3c5f0eb2deb7118718dd08844f66a6cb72f48b5c489
-size 1476294
+oid sha256:392e1269220e7e3feb9e2b256e82cce6a2394a5cabef042fdb10def6b24ff165
+size 111819
diff --git a/tests/Images/Input/Tiff/Calliphora_rgb_jpeg.tiff b/tests/Images/Input/Tiff/Calliphora_rgb_jpeg.tiff
index c9f5fadee..f45aacce4 100644
--- a/tests/Images/Input/Tiff/Calliphora_rgb_jpeg.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_rgb_jpeg.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:ba79ffac35e16208406e073492d770d3a77e51a47112aa02ab8fd98b5a8487b2
-size 198564
+oid sha256:4baf0f4c462e5bef71ab36f505dfff87a31bd1d25deabccd822a359c1075e08e
+size 65748
diff --git a/tests/Images/Input/Tiff/Calliphora_rgb_lzw.tif b/tests/Images/Input/Tiff/Calliphora_rgb_lzw.tif
deleted file mode 100644
index 745052267..000000000
--- a/tests/Images/Input/Tiff/Calliphora_rgb_lzw.tif
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:53006876fcdc655a794462de57eb6b56f4d0cdd3cb8b752c63328db0eb4aa3c1
-size 725085
diff --git a/tests/Images/Input/Tiff/Calliphora_rgb_lzw.tiff b/tests/Images/Input/Tiff/Calliphora_rgb_lzw.tiff
new file mode 100644
index 000000000..5e4cf8be9
--- /dev/null
+++ b/tests/Images/Input/Tiff/Calliphora_rgb_lzw.tiff
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d83d8a81ebb7337f00b319a8c37cfdef07423d6a61006411130e386238dd00dd
+size 121907
diff --git a/tests/Images/Input/Tiff/Calliphora_rgb_lzw_predictor.tiff b/tests/Images/Input/Tiff/Calliphora_rgb_lzw_predictor.tiff
index 99642af52..2fa884f36 100644
--- a/tests/Images/Input/Tiff/Calliphora_rgb_lzw_predictor.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_rgb_lzw_predictor.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:ecb529e5e3e0eca6f5e407b034fa8ba67bb4b9068af9e9b30425b08d30a249c0
-size 1756355
+oid sha256:993207c34358165af5fac0d0b955b56cd79e9707c1c46344863e01cbc9c7707d
+size 126695
diff --git a/tests/Images/Input/Tiff/Calliphora_rgb_packbits.tiff b/tests/Images/Input/Tiff/Calliphora_rgb_packbits.tiff
index 862db0b39..6fc2c9b21 100644
--- a/tests/Images/Input/Tiff/Calliphora_rgb_packbits.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_rgb_packbits.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:59dbb48f10c40cbbd4f5617a9f57536790ce0b9a4cc241dc8d6257095598cb76
-size 2891292
+oid sha256:81e7456578510c85e5bebe8bc7c5796da6e2cd61f5bbe0a1f6bb46b8aee3d695
+size 179949
diff --git a/tests/Images/Input/Tiff/Calliphora_rgb_uncompressed.tiff b/tests/Images/Input/Tiff/Calliphora_rgb_uncompressed.tiff
index 7ebd74d9d..7fc592315 100644
--- a/tests/Images/Input/Tiff/Calliphora_rgb_uncompressed.tiff
+++ b/tests/Images/Input/Tiff/Calliphora_rgb_uncompressed.tiff
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:acb46c990af78fcb0e63849f0f26acffe26833d5cfd2fc77a728baf92166eea3
-size 2893218
+oid sha256:bb25349a7f803aeafc47d8a05deca1a8afdc4bdc5a53e2916f68d5c3e7d8cad3
+size 179207
diff --git a/tests/Images/Input/Tiff/basi3p02_fax4.tiff b/tests/Images/Input/Tiff/basi3p02_fax4.tiff
new file mode 100644
index 000000000..a53f8f36f
--- /dev/null
+++ b/tests/Images/Input/Tiff/basi3p02_fax4.tiff
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:185ae3c4174b323adcf811d125cd77b71768406845923f50395c0baebff57b7c
+size 282
diff --git a/tests/Images/Input/Tiff/basi3p02_fax4_lowerOrderBitsFirst.tiff b/tests/Images/Input/Tiff/basi3p02_fax4_lowerOrderBitsFirst.tiff
new file mode 100644
index 000000000..12d10ffa7
--- /dev/null
+++ b/tests/Images/Input/Tiff/basi3p02_fax4_lowerOrderBitsFirst.tiff
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a19eb117f194718575681a81a4fbe7fe4a1b82b99113707295194090fb935784
+size 282
diff --git a/tests/Images/Input/Tiff/basi3p02_fax4_minisblack.tiff b/tests/Images/Input/Tiff/basi3p02_fax4_minisblack.tiff
new file mode 100644
index 000000000..9c76237b5
--- /dev/null
+++ b/tests/Images/Input/Tiff/basi3p02_fax4_minisblack.tiff
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:af0d8f3c18f96228aa369bc295201a1bfe1b044c23991ff168401adc5402ebb6
+size 308
diff --git a/tests/Images/Input/Tiff/rgb_jpegcompressed_nojpegtable.tiff b/tests/Images/Input/Tiff/rgb_jpegcompressed_nojpegtable.tiff
new file mode 100644
index 000000000..b97ab8830
--- /dev/null
+++ b/tests/Images/Input/Tiff/rgb_jpegcompressed_nojpegtable.tiff
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6b81013d7b0a29ed1ac9c33e175e0c0e69494b93b2b65b692f16d9ea042b9d5d
+size 7759
diff --git a/tests/Images/Input/Tiff/rgb_jpegcompressed_stripped.tiff b/tests/Images/Input/Tiff/rgb_jpegcompressed_stripped.tiff
new file mode 100644
index 000000000..2d43f9778
--- /dev/null
+++ b/tests/Images/Input/Tiff/rgb_jpegcompressed_stripped.tiff
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1f027d8c2ab0b244f04e51b9bf724eac0123e104a2446324496a08bdf5881922
+size 10550
diff --git a/tests/Images/Input/Tiff/rgb_jpeg.tiff b/tests/Images/Input/Tiff/rgb_jpegcompression.tiff
similarity index 100%
rename from tests/Images/Input/Tiff/rgb_jpeg.tiff
rename to tests/Images/Input/Tiff/rgb_jpegcompression.tiff
diff --git a/tests/Images/Input/Tiff/ycbcr_jpegcompressed.tiff b/tests/Images/Input/Tiff/ycbcr_jpegcompressed.tiff
new file mode 100644
index 000000000..18334be2a
--- /dev/null
+++ b/tests/Images/Input/Tiff/ycbcr_jpegcompressed.tiff
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:27fa1d37cd62a9cf105a5e3e015e6a16a13ca7fa82f927a73d32847046c66073
+size 6136