10
10
using SixLabors . ImageSharp . PixelFormats ;
11
11
using SixLabors . ImageSharp . Processing ;
12
12
using SixLabors . ImageSharp . Tests . TestUtilities ;
13
+ using static SixLabors . ImageSharp . Metadata . Profiles . Exif . EncodedString ;
13
14
14
15
// ReSharper disable InconsistentNaming
15
16
namespace SixLabors . ImageSharp . Tests . Formats . Jpg ;
@@ -439,9 +440,8 @@ public void JpegDecoder_DecodeMetadataComment<TPixel>(TestImageProvider<TPixel>
439
440
Assert . Equal ( expectedComment , metadata . Comments . ElementAtOrDefault ( 0 ) . ToString ( ) ) ;
440
441
image . DebugSave ( provider ) ;
441
442
image . CompareToOriginal ( provider ) ;
442
-
443
443
}
444
-
444
+
445
445
// https://github.com/SixLabors/ImageSharp/issues/2758
446
446
[ Theory ]
447
447
[ WithFile ( TestImages . Jpeg . Issues . Issue2758 , PixelTypes . L8 ) ]
@@ -468,6 +468,47 @@ public void Issue2758_DecodeWorks<TPixel>(TestImageProvider<TPixel> provider)
468
468
image . Save ( ms , new JpegEncoder ( ) ) ;
469
469
}
470
470
471
+ // https://github.com/SixLabors/ImageSharp/issues/2857
472
+ [ Theory ]
473
+ [ WithFile ( TestImages . Jpeg . Issues . Issue2857 , PixelTypes . Rgb24 ) ]
474
+ public void Issue2857_SubSubIfds < TPixel > ( TestImageProvider < TPixel > provider )
475
+ where TPixel : unmanaged, IPixel < TPixel >
476
+ {
477
+ using Image < TPixel > image = provider . GetImage ( JpegDecoder . Instance ) ;
478
+
479
+ Assert . Equal ( 5616 , image . Width ) ;
480
+ Assert . Equal ( 3744 , image . Height ) ;
481
+
482
+ JpegMetadata meta = image . Metadata . GetJpegMetadata ( ) ;
483
+ Assert . Equal ( 92 , meta . LuminanceQuality ) ;
484
+ Assert . Equal ( 93 , meta . ChrominanceQuality ) ;
485
+
486
+ ExifProfile exifProfile = image . Metadata . ExifProfile ;
487
+ Assert . NotNull ( exifProfile ) ;
488
+
489
+ using MemoryStream ms = new ( ) ;
490
+ bool hasThumbnail = exifProfile . TryCreateThumbnail ( out _ ) ;
491
+ Assert . False ( hasThumbnail ) ;
492
+
493
+ Assert . Equal ( "BilderBox - Erwin Wodicka / [email protected] " , exifProfile . GetValue ( ExifTag . Copyright ) . Value ) ;
494
+ Assert . Equal ( "Adobe Photoshop CS3 Windows" , exifProfile . GetValue ( ExifTag . Software ) . Value ) ;
495
+
496
+ 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 ) ;
497
+
498
+ Assert . Equal (
499
+ new EncodedString ( CharacterCode . ASCII , "StockSubmitter|Miscellaneous||Miscellaneous$|00|0000330000000110000000000000000|22$@NA_1005010.460@[email protected] $$@$@26$$@$@$@$@205$@$@$@$@$@$@$@$@$@43$@$@$@[email protected] $$@90$$@22$@$@$@$@$@$@$|||" ) ,
500
+ exifProfile . GetValue ( ExifTag . UserComment ) . Value ) ;
501
+
502
+ image . Mutate ( x => x . Crop ( new ( 0 , 0 , 100 , 100 ) ) ) ;
503
+
504
+ image . Save ( ms , new JpegEncoder ( ) ) ;
505
+
506
+ foreach ( IExifValue val in image . Metadata . ExifProfile . Values )
507
+ {
508
+ this . Output . WriteLine ( $ "{ val . Tag } ={ val . GetValue ( ) } ") ;
509
+ }
510
+ }
511
+
471
512
private static void VerifyEncodedStrings ( ExifProfile exif )
472
513
{
473
514
Assert . NotNull ( exif ) ;
0 commit comments