|
|
|
@ -11,6 +11,8 @@ using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs; |
|
|
|
|
|
|
|
using Xunit; |
|
|
|
|
|
|
|
using static SixLabors.ImageSharp.Tests.TestImages.Tiff; |
|
|
|
|
|
|
|
namespace SixLabors.ImageSharp.Tests.Formats.Tiff |
|
|
|
{ |
|
|
|
[Trait("Format", "Tiff")] |
|
|
|
@ -47,67 +49,67 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeRgb_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel24, TiffEncodingMode.Rgb); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeRgb_WithDeflateCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel24, TiffEncodingMode.Rgb, TiffEncoderCompression.Deflate); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeRgb_WithDeflateCompressionAndPredictor_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel24, TiffEncodingMode.Rgb, TiffEncoderCompression.Deflate, usePredictor: true); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeRgb_WithLzwCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel24, TiffEncodingMode.Rgb, TiffEncoderCompression.Lzw); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeRgb_WithLzwCompressionAndPredictor_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel24, TiffEncodingMode.Rgb, TiffEncoderCompression.Lzw, usePredictor: true); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_RgbUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeRgb_WithPackBitsCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel24, TiffEncodingMode.Rgb, TiffEncoderCompression.PackBits); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeGray_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel8, TiffEncodingMode.Gray); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeGray_WithDeflateCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel8, TiffEncodingMode.Gray, TiffEncoderCompression.Deflate); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeGray_WithDeflateCompressionAndPredictor_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel8, TiffEncodingMode.Gray, TiffEncoderCompression.Deflate, usePredictor: true); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeGray_WithLzwCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel8, TiffEncodingMode.Gray, TiffEncoderCompression.Lzw); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeGray_WithLzwCompressionAndPredictor_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel8, TiffEncodingMode.Gray, TiffEncoderCompression.Lzw, usePredictor: true); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_GrayscaleUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeGray_WithPackBitsCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel8, TiffEncodingMode.Gray, TiffEncoderCompression.PackBits); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeColorPalette_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
@ -117,7 +119,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeColorPalette_WithDeflateCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
@ -127,7 +129,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeColorPalette_WithDeflateCompressionAndPredictor_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
@ -137,7 +139,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeColorPalette_WithLzwCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
@ -147,7 +149,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeColorPalette_WithLzwCompressionAndPredictor_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
@ -157,7 +159,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_PaletteUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeColorPalette_WithPackBitsCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
@ -184,27 +186,27 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeBiColor_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel24, TiffEncodingMode.BiColor); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeBiColor_WithDeflateCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel1, TiffEncodingMode.BiColor, TiffEncoderCompression.Deflate); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeBiColor_WithPackBitsCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel1, TiffEncodingMode.BiColor, TiffEncoderCompression.PackBits); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeBiColor_WithCcittGroup3FaxCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel1, TiffEncodingMode.BiColor, TiffEncoderCompression.CcittGroup3Fax); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Tiff.Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] |
|
|
|
[WithFile(Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] |
|
|
|
public void TiffEncoder_EncodeBiColor_WithModifiedHuffmanCompression_Works<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel1, TiffEncodingMode.BiColor, TiffEncoderCompression.ModifiedHuffman); |
|
|
|
|
|
|
|
|