@@ -196,7 +196,7 @@ public Image<TPixel> Decode<TPixel>(Stream stream)
196196 where TPixel : struct , IPixel < TPixel >
197197 {
198198 this . ParseStream ( stream ) ;
199- this . AssignResolution ( ) ;
199+ this . InitDerivedMetaDataProperties ( ) ;
200200 return this . PostProcessIntoImage < TPixel > ( ) ;
201201 }
202202
@@ -207,7 +207,7 @@ public Image<TPixel> Decode<TPixel>(Stream stream)
207207 public IImageInfo Identify ( Stream stream )
208208 {
209209 this . ParseStream ( stream , true ) ;
210- this . AssignResolution ( ) ;
210+ this . InitDerivedMetaDataProperties ( ) ;
211211 return new ImageInfo ( new PixelTypeInfo ( this . BitsPerPixel ) , this . ImageWidth , this . ImageHeight , this . MetaData ) ;
212212 }
213213
@@ -266,7 +266,7 @@ public void ParseStream(Stream stream, bool metadataOnly = false)
266266 {
267267 // It's highly unlikely that APPn related data will be found after the SOS marker
268268 // We should have gathered everything we need by now.
269- break ;
269+ return ;
270270 }
271271
272272 case JpegConstants . Markers . DHT :
@@ -345,11 +345,6 @@ public void ParseStream(Stream stream, bool metadataOnly = false)
345345 // Read on.
346346 fileMarker = FindNextFileMarker ( this . markerBuffer , this . InputStream ) ;
347347 }
348-
349- if ( this . MetaData . IccProfile ? . CheckIsValid ( ) == false )
350- {
351- this . MetaData . IccProfile = null ;
352- }
353348 }
354349
355350 /// <inheritdoc/>
@@ -400,9 +395,9 @@ private JpegColorSpace DeduceJpegColorSpace()
400395 }
401396
402397 /// <summary>
403- /// Assigns the horizontal and vertical resolution to the image if it has a JFIF header or EXIF metadata .
398+ /// Assigns derived metadata properties to <see cref="MetaData"/>, eg. horizontal and vertical resolution if it has a JFIF header.
404399 /// </summary>
405- private void AssignResolution ( )
400+ private void InitDerivedMetaDataProperties ( )
406401 {
407402 if ( this . jFif . XDensity > 0 && this . jFif . YDensity > 0 )
408403 {
@@ -425,6 +420,11 @@ private void AssignResolution()
425420 this . MetaData . VerticalResolution = verticalValue ;
426421 }
427422 }
423+
424+ if ( this . MetaData . IccProfile ? . CheckIsValid ( ) == false )
425+ {
426+ this . MetaData . IccProfile = null ;
427+ }
428428 }
429429
430430 /// <summary>
0 commit comments