diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs index 64df61bf0..b5f3e7cf1 100644 --- a/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs +++ b/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs @@ -62,19 +62,19 @@ namespace SixLabors.ImageSharp.Formats.Tiff TiffThrowHelper.ThrowNotSupported("Variable-sized strips are not supported."); } - VerifyRequiredFieldsArePresent(exifProfile); + VerifyRequiredFieldsArePresent(exifProfile, frameMetadata); options.PlanarConfiguration = (TiffPlanarConfiguration?)exifProfile.GetValue(ExifTag.PlanarConfiguration)?.Value ?? DefaultPlanarConfiguration; - options.Predictor = frameMetadata.Predictor ?? TiffFrameMetadata.DefaultPredictor; - options.PhotometricInterpretation = frameMetadata.PhotometricInterpretation ?? TiffFrameMetadata.DefaultPhotometricInterpretation; - options.BitsPerPixel = frameMetadata.BitsPerPixel != null ? (int)frameMetadata.BitsPerPixel.Value : (int)TiffFrameMetadata.DefaultBitsPerPixel; + options.Predictor = frameMetadata.Predictor ?? TiffPredictor.None; + options.PhotometricInterpretation = frameMetadata.PhotometricInterpretation ?? TiffPhotometricInterpretation.Rgb; + options.BitsPerPixel = frameMetadata.BitsPerPixel != null ? (int)frameMetadata.BitsPerPixel.Value : (int)TiffBitsPerPixel.Bit24; options.BitsPerSample = GetBitsPerSample(frameMetadata.BitsPerPixel); options.ParseColorType(exifProfile); options.ParseCompression(frameMetadata.Compression, exifProfile); } - private static void VerifyRequiredFieldsArePresent(ExifProfile exifProfile) + private static void VerifyRequiredFieldsArePresent(ExifProfile exifProfile, TiffFrameMetadata frameMetadata) { if (exifProfile.GetValue(ExifTag.StripOffsets) == null) { @@ -86,7 +86,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff TiffThrowHelper.ThrowImageFormatException("StripByteCounts are missing and are required for decoding the TIFF image!"); } - if (exifProfile.GetValue(ExifTag.BitsPerSample) == null) + if (frameMetadata.BitsPerPixel == null) { TiffThrowHelper.ThrowNotSupported("The TIFF BitsPerSample entry is missing which is required to decode the image!"); } diff --git a/src/ImageSharp/Formats/Tiff/TiffEncoderCore.cs b/src/ImageSharp/Formats/Tiff/TiffEncoderCore.cs index 61dcd0625..6811601e3 100644 --- a/src/ImageSharp/Formats/Tiff/TiffEncoderCore.cs +++ b/src/ImageSharp/Formats/Tiff/TiffEncoderCore.cs @@ -54,6 +54,26 @@ namespace SixLabors.ImageSharp.Formats.Tiff /// private readonly DeflateCompressionLevel compressionLevel; + /// + /// The default predictor is None. + /// + private const TiffPredictor DefaultPredictor = TiffPredictor.None; + + /// + /// The default bits per pixel is Bit24. + /// + private const TiffBitsPerPixel DefaultBitsPerPixel = TiffBitsPerPixel.Bit24; + + /// + /// The default compression is None. + /// + private const TiffCompression DefaultCompression = TiffCompression.None; + + /// + /// The default photometric interpretation is Rgb. + /// + private const TiffPhotometricInterpretation DefaultPhotometricInterpretation = TiffPhotometricInterpretation.Rgb; + /// /// Initializes a new instance of the class. /// @@ -105,21 +125,33 @@ namespace SixLabors.ImageSharp.Formats.Tiff this.configuration = image.GetConfiguration(); - TiffPhotometricInterpretation rootFramePhotometricInterpretation = GetRootFramePhotometricInterpretation(image); - TiffPhotometricInterpretation photometricInterpretation = this.PhotometricInterpretation == TiffPhotometricInterpretation.PaletteColor - ? TiffPhotometricInterpretation.PaletteColor - : rootFramePhotometricInterpretation; - ImageFrameMetadata rootFrameMetaData = image.Frames.RootFrame.Metadata; TiffFrameMetadata rootFrameTiffMetaData = rootFrameMetaData.GetTiffMetadata(); - TiffBitsPerPixel? rootFrameBitsPerPixel = rootFrameTiffMetaData.BitsPerPixel; - // If the user has not chosen a predictor or compression, set the values from the decoded image, if present. - this.HorizontalPredictor ??= rootFrameTiffMetaData.Predictor; - this.CompressionType ??= rootFrameTiffMetaData.Compression; + // Determine the correct values to encode with. + // EncoderOptions > Metadata > Default. + TiffBitsPerPixel? bitsPerPixel = this.BitsPerPixel ?? rootFrameTiffMetaData.BitsPerPixel; + + TiffPhotometricInterpretation? photometricInterpretation = this.PhotometricInterpretation ?? rootFrameTiffMetaData.PhotometricInterpretation; + + TiffPredictor predictor = + this.HorizontalPredictor + ?? rootFrameTiffMetaData.Predictor + ?? DefaultPredictor; - this.SetBitsPerPixel(rootFrameBitsPerPixel, image.PixelType.BitsPerPixel, photometricInterpretation); - this.SetPhotometricInterpretation(photometricInterpretation); + TiffCompression compression = + this.CompressionType + ?? rootFrameTiffMetaData.Compression + ?? DefaultCompression; + + // Make sure, the bits per pixel and PhotometricInterpretation have values which makes sense in combination with the other chosen values. + bitsPerPixel = this.SanitizeBitsPerPixel(bitsPerPixel, image.PixelType.BitsPerPixel, photometricInterpretation, compression); + photometricInterpretation = this.SanitizePhotometricInterpretation(photometricInterpretation, bitsPerPixel, compression); + + this.BitsPerPixel = bitsPerPixel; + this.PhotometricInterpretation = photometricInterpretation; + this.CompressionType = compression; + this.HorizontalPredictor = predictor; using (var writer = new TiffStreamWriter(stream)) { @@ -270,98 +302,65 @@ namespace SixLabors.ImageSharp.Formats.Tiff return nextIfdMarker; } - private void SetPhotometricInterpretation(TiffPhotometricInterpretation? photometricInterpretation) + private TiffPhotometricInterpretation SanitizePhotometricInterpretation(TiffPhotometricInterpretation? photometricInterpretation, TiffBitsPerPixel? bitsPerPixel, TiffCompression compression) { // Make sure, that the fax compressions are only used together with the WhiteIsZero. - if (this.CompressionType == TiffCompression.CcittGroup3Fax || this.CompressionType == TiffCompression.Ccitt1D) + if (compression == TiffCompression.CcittGroup3Fax || compression == TiffCompression.Ccitt1D) { - // The user has not specified a preferred photometric interpretation. - if (this.PhotometricInterpretation == null) - { - this.PhotometricInterpretation = TiffPhotometricInterpretation.WhiteIsZero; - this.BitsPerPixel = TiffBitsPerPixel.Bit1; - return; - } - - if (this.PhotometricInterpretation != TiffPhotometricInterpretation.WhiteIsZero && this.PhotometricInterpretation != TiffPhotometricInterpretation.BlackIsZero) - { - TiffThrowHelper.ThrowImageFormatException( - $"The {this.CompressionType} compression and {this.PhotometricInterpretation} aren't compatible. Please use {this.CompressionType} only with {TiffPhotometricInterpretation.BlackIsZero} or {TiffPhotometricInterpretation.WhiteIsZero}."); - } - else - { - // The “normal” PhotometricInterpretation for bilevel CCITT compressed data is WhiteIsZero. - this.PhotometricInterpretation = TiffPhotometricInterpretation.WhiteIsZero; - } - - return; - } - - switch (this.PhotometricInterpretation) - { - // The currently supported values by the encoder for photometric interpretation: - case TiffPhotometricInterpretation.PaletteColor: - case TiffPhotometricInterpretation.BlackIsZero: - case TiffPhotometricInterpretation.WhiteIsZero: - break; - - default: - this.PhotometricInterpretation = TiffPhotometricInterpretation.Rgb; - break; + // The “normal” PhotometricInterpretation for bilevel CCITT compressed data is WhiteIsZero. + return TiffPhotometricInterpretation.WhiteIsZero; } // Use the bits per pixel to determine the photometric interpretation. - this.SetPhotometricInterpretationWithBitsPerPixel(this.BitsPerPixel, photometricInterpretation); - } - - private void SetPhotometricInterpretationWithBitsPerPixel(TiffBitsPerPixel? bitsPerPixel, TiffPhotometricInterpretation? photometricInterpretation) - { switch (bitsPerPixel) { case TiffBitsPerPixel.Bit1: - this.PhotometricInterpretation = TiffPhotometricInterpretation.BlackIsZero; - break; + return TiffPhotometricInterpretation.BlackIsZero; case TiffBitsPerPixel.Bit4: - this.PhotometricInterpretation = TiffPhotometricInterpretation.PaletteColor; - break; + return TiffPhotometricInterpretation.PaletteColor; case TiffBitsPerPixel.Bit8: - this.PhotometricInterpretation = photometricInterpretation == TiffPhotometricInterpretation.PaletteColor + return photometricInterpretation == TiffPhotometricInterpretation.PaletteColor ? TiffPhotometricInterpretation.PaletteColor : TiffPhotometricInterpretation.BlackIsZero; + } - break; - default: - this.PhotometricInterpretation = TiffPhotometricInterpretation.Rgb; - break; + if (photometricInterpretation.HasValue) + { + return photometricInterpretation.Value; } + + return DefaultPhotometricInterpretation; } - private void SetBitsPerPixel(TiffBitsPerPixel? rootFrameBitsPerPixel, int inputBitsPerPixel, TiffPhotometricInterpretation photometricInterpretation) + private TiffBitsPerPixel SanitizeBitsPerPixel(TiffBitsPerPixel? bitsPerPixel, int inputBitsPerPixel, TiffPhotometricInterpretation? photometricInterpretation, TiffCompression compression) { - this.BitsPerPixel ??= rootFrameBitsPerPixel; - + // Make sure Palette color is only used with 4 and 8 bit per pixel. if (photometricInterpretation == TiffPhotometricInterpretation.PaletteColor) { - if (this.BitsPerPixel != TiffBitsPerPixel.Bit8 && this.BitsPerPixel != TiffBitsPerPixel.Bit4) + if (bitsPerPixel != TiffBitsPerPixel.Bit8 && bitsPerPixel != TiffBitsPerPixel.Bit4) { - this.BitsPerPixel = TiffBitsPerPixel.Bit8; + return TiffBitsPerPixel.Bit8; } + } - return; + if (compression == TiffCompression.Ccitt1D || compression == TiffCompression.CcittGroup3Fax) + { + return TiffBitsPerPixel.Bit1; } - if (this.BitsPerPixel.HasValue) + if (bitsPerPixel.HasValue) { - return; + return bitsPerPixel.Value; } - if (this.PhotometricInterpretation == null && inputBitsPerPixel == 8) + // If no photometric interpretation was chosen, the input image bit per pixel should be preserved. + if (photometricInterpretation == null) { - this.BitsPerPixel = TiffBitsPerPixel.Bit8; - return; + // At the moment only 8 and 32 bits per pixel can be preserved by the tiff encoder. + return inputBitsPerPixel == 8 ? TiffBitsPerPixel.Bit8 : DefaultBitsPerPixel; } - switch (this.PhotometricInterpretation) + switch (photometricInterpretation) { case TiffPhotometricInterpretation.BlackIsZero: case TiffPhotometricInterpretation.WhiteIsZero: @@ -369,37 +368,28 @@ namespace SixLabors.ImageSharp.Formats.Tiff this.CompressionType == TiffCompression.CcittGroup3Fax || this.CompressionType == TiffCompression.CcittGroup4Fax) { - this.BitsPerPixel = TiffBitsPerPixel.Bit1; + return TiffBitsPerPixel.Bit1; } else { - this.BitsPerPixel = TiffBitsPerPixel.Bit8; + return TiffBitsPerPixel.Bit8; } - break; case TiffPhotometricInterpretation.PaletteColor: - if (this.BitsPerPixel != TiffBitsPerPixel.Bit8 && this.BitsPerPixel != TiffBitsPerPixel.Bit4) + if (bitsPerPixel != TiffBitsPerPixel.Bit8 && bitsPerPixel != TiffBitsPerPixel.Bit4) { - this.BitsPerPixel = TiffBitsPerPixel.Bit8; + return TiffBitsPerPixel.Bit8; + } + else + { + return bitsPerPixel.Value; } - break; case TiffPhotometricInterpretation.Rgb: - this.BitsPerPixel = TiffBitsPerPixel.Bit24; - break; - default: - this.PhotometricInterpretation = TiffPhotometricInterpretation.Rgb; - this.BitsPerPixel = TiffBitsPerPixel.Bit24; - break; + return TiffBitsPerPixel.Bit24; } - } - private static TiffPhotometricInterpretation GetRootFramePhotometricInterpretation(Image image) - { - ExifProfile exifProfile = image.Frames.RootFrame.Metadata.ExifProfile; - return exifProfile?.GetValue(ExifTag.PhotometricInterpretation) != null - ? (TiffPhotometricInterpretation)exifProfile?.GetValue(ExifTag.PhotometricInterpretation).Value - : TiffPhotometricInterpretation.BlackIsZero; + return DefaultBitsPerPixel; } } } diff --git a/src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs b/src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs index baba5195d..25a0578e9 100644 --- a/src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs +++ b/src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs @@ -11,26 +11,6 @@ namespace SixLabors.ImageSharp.Formats.Tiff /// public class TiffFrameMetadata : IDeepCloneable { - /// - /// The default predictor is None. - /// - public const TiffPredictor DefaultPredictor = TiffPredictor.None; - - /// - /// The default bits per pixel is Bit24. - /// - public const TiffBitsPerPixel DefaultBitsPerPixel = TiffBitsPerPixel.Bit24; - - /// - /// The default compression is None. - /// - public const TiffCompression DefaultCompression = TiffCompression.None; - - /// - /// The default photometric interpretation is BlackIsZero. - /// - public const TiffPhotometricInterpretation DefaultPhotometricInterpretation = TiffPhotometricInterpretation.BlackIsZero; - /// /// Initializes a new instance of the class. /// @@ -42,7 +22,13 @@ namespace SixLabors.ImageSharp.Formats.Tiff /// Initializes a new instance of the class. /// /// The other tiff frame metadata. - private TiffFrameMetadata(TiffFrameMetadata other) => this.BitsPerPixel = other.BitsPerPixel; + private TiffFrameMetadata(TiffFrameMetadata other) + { + this.BitsPerPixel = other.BitsPerPixel; + this.Compression = other.Compression; + this.PhotometricInterpretation = other.PhotometricInterpretation; + this.Predictor = other.Predictor; + } /// /// Gets or sets the bits per pixel. @@ -84,17 +70,20 @@ namespace SixLabors.ImageSharp.Formats.Tiff /// The Exif profile containing tiff frame directory tags. internal static void Parse(TiffFrameMetadata meta, ExifProfile profile) { - profile ??= new ExifProfile(); - - ushort[] bitsPerSample = profile.GetValue(ExifTag.BitsPerSample)?.Value; - meta.BitsPerPixel = BitsPerPixelFromBitsPerSample(bitsPerSample); - meta.Compression = (TiffCompression?)profile.GetValue(ExifTag.Compression)?.Value ?? DefaultCompression; - meta.PhotometricInterpretation = (TiffPhotometricInterpretation?)profile.GetValue(ExifTag.PhotometricInterpretation)?.Value ?? DefaultPhotometricInterpretation; - meta.Predictor = (TiffPredictor?)profile.GetValue(ExifTag.Predictor)?.Value ?? DefaultPredictor; - - profile.RemoveValue(ExifTag.Compression); - profile.RemoveValue(ExifTag.PhotometricInterpretation); - profile.RemoveValue(ExifTag.Predictor); + if (profile != null) + { + ushort[] bitsPerSample = profile.GetValue(ExifTag.BitsPerSample)?.Value; + meta.BitsPerPixel = BitsPerPixelFromBitsPerSample(bitsPerSample); + meta.Compression = (TiffCompression?)profile.GetValue(ExifTag.Compression)?.Value; + meta.PhotometricInterpretation = + (TiffPhotometricInterpretation?)profile.GetValue(ExifTag.PhotometricInterpretation)?.Value; + meta.Predictor = (TiffPredictor?)profile.GetValue(ExifTag.Predictor)?.Value; + + profile.RemoveValue(ExifTag.BitsPerSample); + profile.RemoveValue(ExifTag.Compression); + profile.RemoveValue(ExifTag.PhotometricInterpretation); + profile.RemoveValue(ExifTag.Predictor); + } } /// @@ -102,11 +91,11 @@ namespace SixLabors.ImageSharp.Formats.Tiff /// /// The tiff bits per sample. /// Bits per pixel. - private static TiffBitsPerPixel BitsPerPixelFromBitsPerSample(ushort[] bitsPerSample) + private static TiffBitsPerPixel? BitsPerPixelFromBitsPerSample(ushort[] bitsPerSample) { if (bitsPerSample == null) { - return DefaultBitsPerPixel; + return null; } int bitsPerPixel = 0; @@ -119,17 +108,6 @@ namespace SixLabors.ImageSharp.Formats.Tiff } /// - public IDeepCloneable DeepClone() - { - var clone = new TiffFrameMetadata - { - BitsPerPixel = this.BitsPerPixel, - Compression = this.Compression, - PhotometricInterpretation = this.PhotometricInterpretation, - Predictor = this.Predictor - }; - - return clone; - } + public IDeepCloneable DeepClone() => new TiffFrameMetadata(this); } } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs index ce4b4f165..bd61ac4b8 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs @@ -55,7 +55,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff [Theory] [InlineData(TiffBitsPerPixel.Bit24)] - [InlineData(TiffBitsPerPixel.Bit8)] + [InlineData(TiffBitsPerPixel.Bit8)] [InlineData(TiffBitsPerPixel.Bit4)] [InlineData(TiffBitsPerPixel.Bit1)] public void EncoderOptions_SetBitPerPixel_Works(TiffBitsPerPixel bitsPerPixel) @@ -136,8 +136,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff // assert memStream.Position = 0; using var output = Image.Load(Configuration, memStream); - ExifProfile exifProfile = output.Frames.RootFrame.Metadata.ExifProfile; - var frameMetaData = TiffFrameMetadata.Parse(exifProfile); + TiffFrameMetadata frameMetaData = output.Frames.RootFrame.Metadata.GetTiffMetadata(); Assert.Equal(expectedBitsPerPixel, frameMetaData.BitsPerPixel); } @@ -156,8 +155,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff // assert memStream.Position = 0; using var output = Image.Load(Configuration, memStream); - ExifProfile exifProfile = output.Frames.RootFrame.Metadata.ExifProfile; - var frameMetaData = TiffFrameMetadata.Parse(exifProfile); + var frameMetaData = output.Frames.RootFrame.Metadata.GetTiffMetadata(); Assert.Equal(expectedBitsPerPixel, frameMetaData.BitsPerPixel); } @@ -184,11 +182,11 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff } [Theory] - [WithFile(RgbLzwNoPredictor, PixelTypes.Rgba32, TiffPredictor.None)] + [WithFile(RgbLzwNoPredictor, PixelTypes.Rgba32, null)] [WithFile(RgbLzwPredictor, PixelTypes.Rgba32, TiffPredictor.Horizontal)] - [WithFile(RgbDeflate, PixelTypes.Rgba32, TiffPredictor.None)] + [WithFile(RgbDeflate, PixelTypes.Rgba32, null)] [WithFile(RgbDeflatePredictor, PixelTypes.Rgba32, TiffPredictor.Horizontal)] - public void TiffEncoder_PreservesPredictor(TestImageProvider provider, TiffPredictor expectedPredictor) + public void TiffEncoder_PreservesPredictor(TestImageProvider provider, TiffPredictor? expectedPredictor) where TPixel : unmanaged, IPixel { // arrange @@ -230,20 +228,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff Assert.Equal(expectedCompression, frameMetaData.Compression); } - [Theory] - [InlineData(TiffPhotometricInterpretation.PaletteColor, TiffCompression.CcittGroup3Fax)] - [InlineData(TiffPhotometricInterpretation.PaletteColor, TiffCompression.Ccitt1D)] - public void TiffEncoder_IncompatibilityOptions_ThrowsImageFormatException(TiffPhotometricInterpretation photometricInterpretation, TiffCompression compression) - { - // arrange - using var input = new Image(10, 10); - var encoder = new TiffEncoder() { PhotometricInterpretation = photometricInterpretation, Compression = compression }; - using var memStream = new MemoryStream(); - - // act - Assert.Throws(() => input.Save(memStream, encoder)); - } - [Theory] [WithFile(Calliphora_RgbUncompressed, PixelTypes.Rgba32)] public void TiffEncoder_EncodeRgb_Works(TestImageProvider provider) @@ -350,7 +334,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff [Theory] [WithFile(Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] public void TiffEncoder_EncodeBiColor_Works(TestImageProvider provider) - where TPixel : unmanaged, IPixel => TestTiffEncoderCore(provider, TiffBitsPerPixel.Bit24, TiffPhotometricInterpretation.BlackIsZero); + where TPixel : unmanaged, IPixel => TestTiffEncoderCore(provider, TiffBitsPerPixel.Bit1, TiffPhotometricInterpretation.BlackIsZero); [Theory] [WithFile(Calliphora_BiColorUncompressed, PixelTypes.Rgba32)] diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs index 7f799e73c..f52b74e83 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs @@ -134,7 +134,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff Assert.NotNull(rootFrameMetaData.XmpProfile); Assert.NotNull(rootFrameMetaData.ExifProfile); Assert.Equal(2599, rootFrameMetaData.XmpProfile.Length); - Assert.Equal(27, rootFrameMetaData.ExifProfile.Values.Count); + Assert.Equal(26, rootFrameMetaData.ExifProfile.Values.Count); } } } @@ -170,9 +170,10 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff TiffFrameMetadata tiffFrameMetadata = rootFrame.Metadata.GetTiffMetadata(); Assert.NotNull(exifProfile); - // The original exifProfile has 30 values, but 3 of those values will be stored in the TiffFrameMetaData + // The original exifProfile has 30 values, but 4 of those values will be stored in the TiffFrameMetaData // and removed from the profile on decode. - Assert.Equal(27, exifProfile.Values.Count); + Assert.Equal(26, exifProfile.Values.Count); + Assert.Equal(TiffBitsPerPixel.Bit4, tiffFrameMetadata.BitsPerPixel); Assert.Equal(TiffCompression.Lzw, tiffFrameMetadata.Compression); Assert.Equal("This is Название", exifProfile.GetValue(ExifTag.ImageDescription).Value); Assert.Equal("This is Изготовитель камеры", exifProfile.GetValue(ExifTag.Make).Value); @@ -213,9 +214,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff TiffMetadata tiffMetaData = image.Metadata.GetTiffMetadata(); Assert.NotNull(tiffMetaData); Assert.Equal(ByteOrder.LittleEndian, tiffMetaData.ByteOrder); - - var frameMetaData = TiffFrameMetadata.Parse(exifProfile); - Assert.Equal(TiffBitsPerPixel.Bit4, frameMetaData.BitsPerPixel); } }