@@ -439,9 +439,8 @@ public void JpegDecoder_DecodeMetadataComment<TPixel>(TestImageProvider<TPixel>
439439 Assert . Equal ( expectedComment , metadata . Comments . ElementAtOrDefault ( 0 ) . ToString ( ) ) ;
440440 image . DebugSave ( provider ) ;
441441 image . CompareToOriginal ( provider ) ;
442-
443442 }
444-
443+
445444 // https://github.com/SixLabors/ImageSharp/issues/2758
446445 [ Theory ]
447446 [ WithFile ( TestImages . Jpeg . Issues . Issue2758 , PixelTypes . L8 ) ]
@@ -468,6 +467,45 @@ public void Issue2758_DecodeWorks<TPixel>(TestImageProvider<TPixel> provider)
468467 image . Save ( ms , new JpegEncoder ( ) ) ;
469468 }
470469
470+ // https://github.com/SixLabors/ImageSharp/issues/2857
471+ [ Theory ]
472+ [ WithFile ( TestImages . Jpeg . Issues . Issue2857 , PixelTypes . Rgb24 ) ]
473+ public void Issue2857_SubSubIfds < TPixel > ( TestImageProvider < TPixel > provider )
474+ where TPixel : unmanaged, IPixel < TPixel >
475+ {
476+ using Image < TPixel > image = provider . GetImage ( JpegDecoder . Instance ) ;
477+
478+ Assert . Equal ( 5616 , image . Width ) ;
479+ Assert . Equal ( 3744 , image . Height ) ;
480+
481+ JpegMetadata meta = image . Metadata . GetJpegMetadata ( ) ;
482+ Assert . Equal ( 92 , meta . LuminanceQuality ) ;
483+ Assert . Equal ( 93 , meta . ChrominanceQuality ) ;
484+
485+ ExifProfile exifProfile = image . Metadata . ExifProfile ;
486+ Assert . NotNull ( exifProfile ) ;
487+
488+ using MemoryStream ms = new ( ) ;
489+ bool hasThumbnail = exifProfile . TryCreateThumbnail ( out _ ) ;
490+ Assert . False ( hasThumbnail ) ;
491+
492+ Assert . Equal ( "BilderBox - Erwin Wodicka / [email protected] " , exifProfile . GetValue ( ExifTag . Copyright ) . Value ) ; 493+ Assert . Equal ( "Adobe Photoshop CS3 Windows" , exifProfile . GetValue ( ExifTag . Software ) . Value ) ;
494+
495+ Assert . Equal ( "Carers; seniors; caregiver; senior care; retirement home; hands; old; elderly; elderly caregiver; elder care; elderly care; geriatric care; nursing home; age; old age care; outpatient; needy; health care; home nurse; home care; sick; retirement; medical; mobile; the elderly; nursing department; nursing treatment; nursing; care services; nursing services; nursing care; nursing allowance; nursing homes; home nursing; care category; nursing class; care; nursing shortage; nursing patient care staff\0 " , exifProfile . GetValue ( ExifTag . XPKeywords ) . Value ) ;
496+
497+ Assert . Equal (
498+ new EncodedString ( EncodedString . CharacterCode . ASCII , "StockSubmitter|Miscellaneous||Miscellaneous$|00|0000330000000110000000000000000|22$@NA_1005010.460@[email protected] $$@$@26$$@$@$@$@205$@$@$@$@$@$@$@$@$@43$@$@$@[email protected] $$@90$$@22$@$@$@$@$@$@$|||" ) , 499+ exifProfile . GetValue ( ExifTag . UserComment ) . Value ) ;
500+
501+ // the profile contains 4 duplicated UserComment
502+ Assert . Equal ( 1 , exifProfile . Values . Count ( t => t . Tag == ExifTag . UserComment ) ) ;
503+
504+ image . Mutate ( x => x . Crop ( new ( 0 , 0 , 100 , 100 ) ) ) ;
505+
506+ image . Save ( ms , new JpegEncoder ( ) ) ;
507+ }
508+
471509 private static void VerifyEncodedStrings ( ExifProfile exif )
472510 {
473511 Assert . NotNull ( exif ) ;
0 commit comments