diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs index 8a6ac48fe..e4962759d 100644 --- a/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs +++ b/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs @@ -82,7 +82,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff public TiffColorType ColorType { get; set; } /// - /// Gets or sets the compression implementation to use when decoding the image. + /// Gets or sets the compression used, when the image was encoded. /// public TiffDecoderCompressionType CompressionType { get; set; } @@ -122,8 +122,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff } this.metadata = framesMetadata.CreateMetadata(this.ignoreMetadata, tiffStream.ByteOrder); - this.tiffMetaData = this.metadata.GetTiffMetadata(); - this.SetBitsPerPixel(framesMetadata); + this.SetTiffFormatMetaData(framesMetadata, tiffStream.ByteOrder); // todo: tiff frames can have different sizes { @@ -143,30 +142,6 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff return image; } - private void SetBitsPerPixel(List framesMetadata) - { - TiffFrameMetadata firstMetaData = framesMetadata.First(); - ushort[] bitsPerSample = firstMetaData.BitsPerSample; - var bitsPerPixel = 0; - foreach (var bps in bitsPerSample) - { - bitsPerPixel += bps; - } - - if (bitsPerPixel == 24) - { - this.tiffMetaData.BitsPerPixel = TiffBitsPerPixel.Pixel24; - } - else if (bitsPerPixel == 8) - { - this.tiffMetaData.BitsPerPixel = TiffBitsPerPixel.Pixel8; - } - else if (bitsPerPixel == 1) - { - this.tiffMetaData.BitsPerPixel = TiffBitsPerPixel.Pixel1; - } - } - /// public IImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken) { @@ -182,7 +157,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff framesMetadata.Add(new TiffFrameMetadata() { Tags = ifd }); } - ImageMetadata metadata = framesMetadata.CreateMetadata(this.ignoreMetadata, tiffStream.ByteOrder); + this.SetTiffFormatMetaData(framesMetadata, tiffStream.ByteOrder); TiffFrameMetadata root = framesMetadata.First(); int bitsPerPixel = 0; @@ -194,6 +169,38 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff return new ImageInfo(new PixelTypeInfo(bitsPerPixel), (int)root.Width, (int)root.Height, metadata); } + private void SetTiffFormatMetaData(List framesMetadata, TiffByteOrder byteOrder) + { + this.metadata = framesMetadata.CreateMetadata(this.ignoreMetadata, byteOrder); + this.tiffMetaData = this.metadata.GetTiffMetadata(); + TiffFrameMetadata firstFrameMetaData = framesMetadata.First(); + this.SetBitsPerPixel(firstFrameMetaData); + this.tiffMetaData.Compression = firstFrameMetaData.Compression; + } + + private void SetBitsPerPixel(TiffFrameMetadata firstFrameMetaData) + { + ushort[] bitsPerSample = firstFrameMetaData.BitsPerSample; + var bitsPerPixel = 0; + foreach (var bps in bitsPerSample) + { + bitsPerPixel += bps; + } + + if (bitsPerPixel == 24) + { + this.tiffMetaData.BitsPerPixel = TiffBitsPerPixel.Pixel24; + } + else if (bitsPerPixel == 8) + { + this.tiffMetaData.BitsPerPixel = TiffBitsPerPixel.Pixel8; + } + else if (bitsPerPixel == 1) + { + this.tiffMetaData.BitsPerPixel = TiffBitsPerPixel.Pixel1; + } + } + private static TiffStream CreateStream(Stream stream) { TiffByteOrder byteOrder = ReadByteOrder(stream); diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderHelpers.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderHelpers.cs index b69c57093..c54a2cc90 100644 --- a/src/ImageSharp/Formats/Tiff/TiffDecoderHelpers.cs +++ b/src/ImageSharp/Formats/Tiff/TiffDecoderHelpers.cs @@ -300,22 +300,6 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff private static void ParsePhotometric(this TiffDecoderCore options, TiffFrameMetadata entries) { - /* - if (!entries.TryGetSingleNumber(ExifTag.PhotometricInterpretation, out uint photometricInterpretation)) - { - if (entries.Compression == TiffCompression.Ccitt1D) - { - photometricInterpretation = (uint)TiffPhotometricInterpretation.WhiteIsZero; - } - else - { - TiffThrowHelper.ThrowNotSupported("The TIFF photometric interpretation entry is missing."); - } - } - - options.PhotometricInterpretation = (TiffPhotometricInterpretation)photometricInterpretation; - /* */ - // There is no default for PhotometricInterpretation, and it is required. options.PhotometricInterpretation = entries.PhotometricInterpretation; } diff --git a/src/ImageSharp/Formats/Tiff/TiffMetadata.cs b/src/ImageSharp/Formats/Tiff/TiffMetadata.cs index a3ee80fc3..cfb9fa8bb 100644 --- a/src/ImageSharp/Formats/Tiff/TiffMetadata.cs +++ b/src/ImageSharp/Formats/Tiff/TiffMetadata.cs @@ -38,6 +38,11 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff /// public TiffBitsPerPixel BitsPerPixel { get; set; } = TiffBitsPerPixel.Pixel24; + /// + /// Gets or sets the compression used to create the TIFF file. + /// + public TiffCompression Compression { get; set; } = TiffCompression.None; + /// /// Gets or sets the XMP profile. /// diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpMetadataTests.cs index b14956379..143eac4aa 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpMetadataTests.cs @@ -16,12 +16,14 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp [Fact] public void CloneIsDeep() { - var meta = new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Pixel24 }; + var meta = new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Pixel24, InfoHeaderType = BmpInfoHeaderType.Os2Version2 }; var clone = (BmpMetadata)meta.DeepClone(); clone.BitsPerPixel = BmpBitsPerPixel.Pixel32; + clone.InfoHeaderType = BmpInfoHeaderType.WinVersion2; Assert.False(meta.BitsPerPixel.Equals(clone.BitsPerPixel)); + Assert.False(meta.InfoHeaderType.Equals(clone.InfoHeaderType)); } [Theory] diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs index 2e6ca6318..86b4e32ac 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs @@ -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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel { @@ -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(TestImageProvider provider) where TPixel : unmanaged, IPixel { @@ -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(TestImageProvider provider) where TPixel : unmanaged, IPixel { @@ -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(TestImageProvider provider) where TPixel : unmanaged, IPixel { @@ -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(TestImageProvider provider) where TPixel : unmanaged, IPixel { @@ -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(TestImageProvider provider) where TPixel : unmanaged, IPixel { @@ -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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => 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(TestImageProvider provider) where TPixel : unmanaged, IPixel => TestTiffEncoderCore(provider, TiffBitsPerPixel.Pixel1, TiffEncodingMode.BiColor, TiffEncoderCompression.ModifiedHuffman); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs index e3b574abe..9616ce1cf 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs @@ -1,6 +1,8 @@ // Copyright (c) Six Labors. // Licensed under the Apache License, Version 2.0. +using System.IO; +using System.Linq; using SixLabors.ImageSharp.Formats.Experimental.Tiff; using SixLabors.ImageSharp.Formats.Experimental.Tiff.Constants; using SixLabors.ImageSharp.Metadata; @@ -8,16 +10,94 @@ using SixLabors.ImageSharp.PixelFormats; using Xunit; +using static SixLabors.ImageSharp.Tests.TestImages.Tiff; + namespace SixLabors.ImageSharp.Tests.Formats.Tiff { [Trait("Format", "Tiff")] public class TiffMetadataTests { - public static readonly string[] MetadataImages = TestImages.Tiff.Metadata; + [Fact] + public void CloneIsDeep() + { + var meta = new TiffMetadata + { + Compression = TiffCompression.Deflate, + BitsPerPixel = TiffBitsPerPixel.Pixel8, + ByteOrder = TiffByteOrder.BigEndian, + XmpProfile = new byte[3] + }; + + var clone = (TiffMetadata)meta.DeepClone(); + + clone.Compression = TiffCompression.None; + clone.BitsPerPixel = TiffBitsPerPixel.Pixel24; + clone.ByteOrder = TiffByteOrder.LittleEndian; + clone.XmpProfile = new byte[1]; + + Assert.False(meta.Compression == clone.Compression); + Assert.False(meta.BitsPerPixel == clone.BitsPerPixel); + Assert.False(meta.ByteOrder == clone.ByteOrder); + Assert.False(meta.XmpProfile.SequenceEqual(clone.XmpProfile)); + } + + [Theory] + [InlineData(Calliphora_BiColorUncompressed, TiffBitsPerPixel.Pixel1)] + [InlineData(GrayscaleUncompressed, TiffBitsPerPixel.Pixel8)] + [InlineData(RgbUncompressed, TiffBitsPerPixel.Pixel24)] + public void Identify_DetectsCorrectBitPerPixel(string imagePath, TiffBitsPerPixel expectedBitsPerPixel) + { + var testFile = TestFile.Create(imagePath); + using var stream = new MemoryStream(testFile.Bytes, false); + + IImageInfo imageInfo = Image.Identify(stream); + + Assert.NotNull(imageInfo); + TiffMetadata tiffMetadata = imageInfo.Metadata.GetTiffMetadata(); + Assert.NotNull(tiffMetadata); + Assert.Equal(expectedBitsPerPixel, tiffMetadata.BitsPerPixel); + } + + [Theory] + [InlineData(GrayscaleUncompressed, TiffCompression.None)] + [InlineData(RgbDeflate, TiffCompression.Deflate)] + [InlineData(SmallRgbLzw, TiffCompression.Lzw)] + [InlineData(Calliphora_Fax3Compressed, TiffCompression.CcittGroup3Fax)] + [InlineData(Calliphora_Fax4Compressed, TiffCompression.CcittGroup4Fax)] + [InlineData(Calliphora_HuffmanCompressed, TiffCompression.Ccitt1D)] + [InlineData(Calliphora_RgbPackbits, TiffCompression.PackBits)] + public void Identify_DetectsCorrectCompression(string imagePath, TiffCompression expectedCompression) + { + var testFile = TestFile.Create(imagePath); + using var stream = new MemoryStream(testFile.Bytes, false); + + IImageInfo imageInfo = Image.Identify(stream); + + Assert.NotNull(imageInfo); + TiffMetadata tiffMetadata = imageInfo.Metadata.GetTiffMetadata(); + Assert.NotNull(tiffMetadata); + Assert.Equal(expectedCompression, tiffMetadata.Compression); + } + + [Theory] + [InlineData(GrayscaleUncompressed, TiffByteOrder.BigEndian)] + [InlineData(LsbToMsbByteOrder, TiffByteOrder.LittleEndian)] + public void Identify_DetectsCorrectByteOrder(string imagePath, TiffByteOrder expectedByteOrder) + { + var testFile = TestFile.Create(imagePath); + using var stream = new MemoryStream(testFile.Bytes, false); + + IImageInfo imageInfo = Image.Identify(stream); + + Assert.NotNull(imageInfo); + TiffMetadata tiffMetadata = imageInfo.Metadata.GetTiffMetadata(); + Assert.NotNull(tiffMetadata); + Assert.Equal(expectedByteOrder, tiffMetadata.ByteOrder); + } [Theory] - [WithFile(TestImages.Tiff.SampleMetadata, PixelTypes.Rgba32, false)] - [WithFile(TestImages.Tiff.SampleMetadata, PixelTypes.Rgba32, true)] + [WithFile(SampleMetadata, PixelTypes.Rgba32, false)] + [WithFile(SampleMetadata, PixelTypes.Rgba32, true)] public void MetadataProfiles(TestImageProvider provider, bool ignoreMetadata) where TPixel : unmanaged, IPixel { diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 93277550b..b2e312ddc 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -517,6 +517,7 @@ namespace SixLabors.ImageSharp.Tests public const string Calliphora_RgbPackbits = "Tiff/Calliphora_rgb_packbits.tiff"; public const string Calliphora_RgbUncompressed = "Tiff/Calliphora_rgb_uncompressed.tiff"; public const string Calliphora_Fax3Compressed = "Tiff/Calliphora_ccitt_fax3.tiff"; + 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"; @@ -559,6 +560,8 @@ namespace SixLabors.ImageSharp.Tests public const string MultiframeDifferentSize = "Tiff/multipage_differentSize.tiff"; public const string MultiframeDifferentVariants = "Tiff/multipage_differentVariants.tiff"; + public const string LsbToMsbByteOrder = "Tiff/b0350_lsb_to_msb.tiff"; + public const string SampleMetadata = "Tiff/metadata_sample.tiff"; public static readonly string[] Multiframes = { MultiframeDeflateWithPreview, MultiframeLzwPredictor /*, MultiFrameDifferentSize, MultiframeDifferentSizeTiled, MultiFrameDifferentVariants,*/ }; diff --git a/tests/Images/Input/Tiff/Calliphora_ccitt_fax4.tiff b/tests/Images/Input/Tiff/Calliphora_ccitt_fax4.tiff new file mode 100644 index 000000000..384d00eaa --- /dev/null +++ b/tests/Images/Input/Tiff/Calliphora_ccitt_fax4.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a2c95aec08b96bca30af344f7d9952a603a951802ce534a5f2c5f563795cbd2 +size 117704 diff --git a/tests/Images/Input/Tiff/b0350_lsb_to_msb.tiff b/tests/Images/Input/Tiff/b0350_lsb_to_msb.tiff new file mode 100644 index 000000000..3b7ee6ac3 --- /dev/null +++ b/tests/Images/Input/Tiff/b0350_lsb_to_msb.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37c6a28f460d8781fdc3bcf0cc9bd23f633b03899563546bfc6234a8478f67f0 +size 68637