@@ -452,6 +452,45 @@ public void Issue2758_DecodeWorks<TPixel>(TestImageProvider<TPixel> provider)
452452 image . Save ( ms , new JpegEncoder ( ) ) ;
453453 }
454454
455+ // https://github.com/SixLabors/ImageSharp/issues/2857
456+ [ Theory ]
457+ [ WithFile ( TestImages . Jpeg . Issues . Issue2857 , PixelTypes . Rgb24 ) ]
458+ public void Issue2857_SubSubIfds < TPixel > ( TestImageProvider < TPixel > provider )
459+ where TPixel : unmanaged, IPixel < TPixel >
460+ {
461+ using Image < TPixel > image = provider . GetImage ( JpegDecoder . Instance ) ;
462+
463+ Assert . Equal ( 5616 , image . Width ) ;
464+ Assert . Equal ( 3744 , image . Height ) ;
465+
466+ JpegMetadata meta = image . Metadata . GetJpegMetadata ( ) ;
467+ Assert . Equal ( 92 , meta . LuminanceQuality ) ;
468+ Assert . Equal ( 93 , meta . ChrominanceQuality ) ;
469+
470+ ExifProfile exifProfile = image . Metadata . ExifProfile ;
471+ Assert . NotNull ( exifProfile ) ;
472+
473+ using MemoryStream ms = new ( ) ;
474+ bool hasThumbnail = exifProfile . TryCreateThumbnail ( out _ ) ;
475+ Assert . False ( hasThumbnail ) ;
476+
477+ Assert . Equal ( "BilderBox - Erwin Wodicka / [email protected] " , exifProfile . GetValue ( ExifTag . Copyright ) . Value ) ; 478+ Assert . Equal ( "Adobe Photoshop CS3 Windows" , exifProfile . GetValue ( ExifTag . Software ) . Value ) ;
479+
480+ 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 ) ;
481+
482+ Assert . Equal (
483+ new EncodedString ( EncodedString . CharacterCode . ASCII , "StockSubmitter|Miscellaneous||Miscellaneous$|00|0000330000000110000000000000000|22$@NA_1005010.460@[email protected] $$@$@26$$@$@$@$@205$@$@$@$@$@$@$@$@$@43$@$@$@[email protected] $$@90$$@22$@$@$@$@$@$@$|||" ) , 484+ exifProfile . GetValue ( ExifTag . UserComment ) . Value ) ;
485+
486+ // the profile contains 4 duplicated UserComment
487+ Assert . Equal ( 1 , exifProfile . Values . Count ( t => t . Tag == ExifTag . UserComment ) ) ;
488+
489+ image . Mutate ( x => x . Crop ( new ( 0 , 0 , 100 , 100 ) ) ) ;
490+
491+ image . Save ( ms , new JpegEncoder ( ) ) ;
492+ }
493+
455494 private static void VerifyEncodedStrings ( ExifProfile exif )
456495 {
457496 Assert . NotNull ( exif ) ;
0 commit comments