@@ -48,15 +48,14 @@ public void EncoderOptions_SetPhotometricInterpretation_Works(TiffPhotometricInt
4848 // assert
4949 memStream . Position = 0 ;
5050 using var output = Image . Load < Rgba32 > ( Configuration , memStream ) ;
51- ExifProfile exifProfile = output . Frames . RootFrame . Metadata . ExifProfile ;
52- var frameMetaData = TiffFrameMetadata . Parse ( exifProfile ) ;
51+ TiffFrameMetadata frameMetaData = output . Frames . RootFrame . Metadata . GetTiffMetadata ( ) ;
5352 Assert . Equal ( expectedBitsPerPixel , frameMetaData . BitsPerPixel ) ;
54- Assert . Equal ( TiffCompression . None , ( TiffCompression ) exifProfile . GetValue ( ExifTag . Compression ) . Value ) ;
53+ Assert . Equal ( TiffCompression . None , frameMetaData . Compression ) ;
5554 }
5655
5756 [ Theory ]
5857 [ InlineData ( TiffBitsPerPixel . Bit24 ) ]
59- [ InlineData ( TiffBitsPerPixel . Bit8 ) ]
58+ [ InlineData ( TiffBitsPerPixel . Bit8 ) ]
6059 [ InlineData ( TiffBitsPerPixel . Bit4 ) ]
6160 [ InlineData ( TiffBitsPerPixel . Bit1 ) ]
6261 public void EncoderOptions_SetBitPerPixel_Works ( TiffBitsPerPixel bitsPerPixel )
@@ -73,10 +72,9 @@ public void EncoderOptions_SetBitPerPixel_Works(TiffBitsPerPixel bitsPerPixel)
7372 memStream . Position = 0 ;
7473 using var output = Image . Load < Rgba32 > ( Configuration , memStream ) ;
7574
76- ExifProfile exifProfile = output . Frames . RootFrame . Metadata . ExifProfile ;
7775 TiffFrameMetadata frameMetaData = output . Frames . RootFrame . Metadata . GetTiffMetadata ( ) ;
7876 Assert . Equal ( bitsPerPixel , frameMetaData . BitsPerPixel ) ;
79- Assert . Equal ( TiffCompression . None , ( TiffCompression ) exifProfile . GetValue ( ExifTag . Compression ) . Value ) ;
77+ Assert . Equal ( TiffCompression . None , frameMetaData . Compression ) ;
8078 }
8179
8280 [ Theory ]
@@ -112,10 +110,9 @@ public void EncoderOptions_SetPhotometricInterpretationAndCompression_Works(Tiff
112110 // assert
113111 memStream . Position = 0 ;
114112 using var output = Image . Load < Rgba32 > ( Configuration , memStream ) ;
115- ExifProfile exifProfile = output . Frames . RootFrame . Metadata . ExifProfile ;
116113 TiffFrameMetadata rootFrameMetaData = output . Frames . RootFrame . Metadata . GetTiffMetadata ( ) ;
117114 Assert . Equal ( expectedBitsPerPixel , rootFrameMetaData . BitsPerPixel ) ;
118- Assert . Equal ( expectedCompression , ( TiffCompression ) exifProfile . GetValue ( ExifTag . Compression ) . Value ) ;
115+ Assert . Equal ( expectedCompression , rootFrameMetaData . Compression ) ;
119116 }
120117
121118 [ Theory ]
@@ -151,7 +148,7 @@ public void TiffEncoder_PreservesBitsPerPixel_WhenInputIsL8()
151148 var tiffEncoder = new TiffEncoder ( ) ;
152149 using Image input = new Image < L8 > ( 10 , 10 ) ;
153150 using var memStream = new MemoryStream ( ) ;
154- var expectedBitsPerPixel = TiffBitsPerPixel . Bit8 ;
151+ TiffBitsPerPixel expectedBitsPerPixel = TiffBitsPerPixel . Bit8 ;
155152
156153 // act
157154 input . Save ( memStream , tiffEncoder ) ;
@@ -183,8 +180,7 @@ public void TiffEncoder_PreservesCompression<TPixel>(TestImageProvider<TPixel> p
183180 // assert
184181 memStream . Position = 0 ;
185182 using var output = Image . Load < Rgba32 > ( Configuration , memStream ) ;
186- ExifProfile exifProfile = output . Frames . RootFrame . Metadata . ExifProfile ;
187- Assert . Equal ( expectedCompression , ( TiffCompression ) exifProfile . GetValue ( ExifTag . Compression ) . Value ) ;
183+ Assert . Equal ( expectedCompression , output . Frames . RootFrame . Metadata . GetTiffMetadata ( ) . Compression ) ;
188184 }
189185
190186 [ Theory ]
@@ -206,8 +202,8 @@ public void TiffEncoder_PreservesPredictor<TPixel>(TestImageProvider<TPixel> pro
206202 // assert
207203 memStream . Position = 0 ;
208204 using var output = Image . Load < Rgba32 > ( Configuration , memStream ) ;
209- ExifProfile exifProfile = output . Frames . RootFrame . Metadata . ExifProfile ;
210- Assert . Equal ( expectedPredictor , ( TiffPredictor ) exifProfile . GetValue ( ExifTag . Predictor ) . Value ) ;
205+ TiffFrameMetadata frameMetadata = output . Frames . RootFrame . Metadata . GetTiffMetadata ( ) ;
206+ Assert . Equal ( expectedPredictor , frameMetadata . Predictor ) ;
211207 }
212208
213209 [ Theory ]
@@ -229,10 +225,9 @@ public void TiffEncoder_EncodesWithCorrectBiColorModeCompression<TPixel>(TestIma
229225 // assert
230226 memStream . Position = 0 ;
231227 using var output = Image . Load < Rgba32 > ( Configuration , memStream ) ;
232- ExifProfile exifProfile = output . Frames . RootFrame . Metadata . ExifProfile ;
233- var frameMetaData = TiffFrameMetadata . Parse ( exifProfile ) ;
228+ TiffFrameMetadata frameMetaData = output . Frames . RootFrame . Metadata . GetTiffMetadata ( ) ;
234229 Assert . Equal ( TiffBitsPerPixel . Bit1 , frameMetaData . BitsPerPixel ) ;
235- Assert . Equal ( expectedCompression , ( TiffCompression ) exifProfile . GetValue ( ExifTag . Compression ) . Value ) ;
230+ Assert . Equal ( expectedCompression , frameMetaData . Compression ) ;
236231 }
237232
238233 [ Theory ]
@@ -402,9 +397,8 @@ private static void TestStripLength<TPixel>(TestImageProvider<TPixel> provider,
402397 var tiffEncoder = new TiffEncoder ( ) { PhotometricInterpretation = photometricInterpretation , Compression = compression } ;
403398 using Image < TPixel > input = provider . GetImage ( ) ;
404399 using var memStream = new MemoryStream ( ) ;
405- ExifProfile exifProfileInput = input . Frames . RootFrame . Metadata . ExifProfile ;
406- var inputCompression = ( TiffCompression ) exifProfileInput . GetValue ( ExifTag . Compression ) . Value ;
407- var inputMeta = TiffFrameMetadata . Parse ( exifProfileInput ) ;
400+ TiffFrameMetadata inputMeta = input . Frames . RootFrame . Metadata . GetTiffMetadata ( ) ;
401+ TiffCompression inputCompression = inputMeta . Compression ?? TiffCompression . None ;
408402
409403 // act
410404 input . Save ( memStream , tiffEncoder ) ;
@@ -413,7 +407,7 @@ private static void TestStripLength<TPixel>(TestImageProvider<TPixel> provider,
413407 memStream . Position = 0 ;
414408 using var output = Image . Load < Rgba32 > ( Configuration , memStream ) ;
415409 ExifProfile exifProfileOutput = output . Frames . RootFrame . Metadata . ExifProfile ;
416- var outputMeta = TiffFrameMetadata . Parse ( exifProfileOutput ) ;
410+ TiffFrameMetadata outputMeta = output . Frames . RootFrame . Metadata . GetTiffMetadata ( ) ;
417411 ImageFrame < Rgba32 > rootFrame = output . Frames . RootFrame ;
418412
419413 Number rowsPerStrip = exifProfileOutput . GetValue ( ExifTag . RowsPerStrip ) != null ? exifProfileOutput . GetValue ( ExifTag . RowsPerStrip ) . Value : TiffConstants . RowsPerStripInfinity ;
0 commit comments