Giter VIP home page Giter VIP logo

metadata-extractor-dotnet's Introduction

metadata-extractor logo

Build Status MetadataExtractor NuGet version MetadataExtractor NuGet download count

MetadataExtractor is a straightforward .NET library for reading metadata from image, movie and audio files.

Installation

The easiest way to use this library is via its NuGet package.

Either add this to your project file

<ItemGroup>
    <PackageReference Include="MetadataExtractor" Version="2.8.1" />
</ItemGroup>

Or type this in Visual Studio's Package Manager Console:

PM> Install-Package MetadataExtractor

Or search for MetadataExtractor in the Visual Studio NuGet Package Manager.

Usage

IEnumerable<Directory> directories = ImageMetadataReader.ReadMetadata(imagePath);

The resulting directories sequence holds potentially many different directories of metadata, depending upon the input image.

To print out all values from all directories:

foreach (var directory in directories)
foreach (var tag in directory.Tags)
    Console.WriteLine($"{directory.Name} - {tag.Name} = {tag.Description}");

Producing:

Exif SubIFD - Exposure Time = 1/60 sec
Exif SubIFD - F-Number = f/8.0
...
Exif IFD0 - Make = NIKON CORPORATION
Exif IFD0 - Model = NIKON D70
...
IPTC - Credit = Drew Noakes
IPTC - City = London
...

Access a specific value, in this case the Exif DateTime tag:

var subIfdDirectory = directories.OfType<ExifSubIfdDirectory>().FirstOrDefault();
var dateTime = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagDateTime);

Features

The library understands several formats of metadata, many of which may be present in a single image:

It supports various file types.

Camera-specific "makernote" data is decoded for cameras manufactured by:

  • Agfa
  • Apple
  • Canon
  • Casio
  • DJI
  • Epson
  • FLIR
  • Fujifilm
  • Kodak
  • Kyocera
  • Leica
  • Minolta
  • Nikon
  • Olympus
  • Panasonic
  • Pentax
  • Reconyx
  • Ricoh
  • Samsung
  • Sanyo
  • Sigma/Foveon
  • Sony

Supported Frameworks

This library targets:

  • .NET 8.0 (net8.0)
  • .NET Framework 4.6.2 (net462)
  • .NET Standard 1.3 (netstandard1.3)
  • .NET Standard 2.1 (netstandard2.1)

All target frameworks are provided via the one NuGet package.

net8.0 implements .NET 8, including support for NativeAOT.

netstandard1.3 implements version 1.3 of the .NET Standard which covers .NET Core, Mono, Xamarin platforms, UWP, and future platforms.

netstandard2.1 implements version 2.1 of the .NET Standard, which uses newer APIs where possible.

net462 targets the full .NET Framework, from version 4.6.2 onwards.

A PCL build was supported until version 1.5.3 which supported Silverlight 5.0, Windows 8.0, Windows Phone 8.1 and Windows Phone Silverlight 8.0. PCL versions did not support file-system metadata due to restricted IO APIs.

A net3.5 build was supported until version 2.8.1. Support for this framework was dropped in early 2024 to enable use of newer, more efficient, .NET APIs.

Building

Building this repo requires a recent version of Visual Studio 2022. Ensure you have the .NET Core Development Tools workload installed via the Visual Studio Installer.

The library itself, once built, may be consumed from projects in much earlier versions of Visual Studio.

Questions & Feedback

The quickest way to have your questions answered is via Stack Overflow. Check whether your question has already been asked, and if not, ask a new one tagged with both metadata-extractor and .net.

Bugs and feature requests should be provided via the project's issue tracker. Please attach sample images where possible as most issues cannot be investigated without an image.

Contributing

If you want to get your hands dirty, making a pull request is a great way to enhance the library. In general it's best to create an issue first that captures the problem you want to address. You can discuss your proposed solution in that issue. This gives others a chance to provide feedback before you spend your valuable time working on it.

An easier way to help is to contribute to the sample image file library used for research and testing.

Credits

This library is developed by Drew Noakes and contributors.

Thanks are due to the many users who sent in suggestions, bug reports, sample images from their cameras as well as encouragement. Wherever possible, they have been credited in the source code and commit logs.

This library was originally written in Java in 2002. In 2014, Yakov Danilov (for Imazen LLC) converted the code to C# using Sharpen. The code has subsequently been edited to provide a more idiomatic .NET API. Both projects are now developed in unison and aim to be functionally equivalent.

Other languages

  • Java metadata-extractor is the original implementation of this project, from which this .NET version was ported
  • PHP php-metadata-extractor wraps the Java project, making it available to users of PHP

More information about this project is available at:

metadata-extractor-dotnet's People

Contributors

akoslukacs avatar baloogan avatar crener avatar d5smith avatar dmitry-shechtman avatar don-vip avatar drewnoakes avatar drjohnmelville avatar flemingm avatar iamcarbon avatar j4m3z0r avatar kirk-marple avatar kleasmcholthuis avatar kwhopper avatar lilith avatar michafrank avatar patricksadowski avatar reinfallt avatar rupertavery avatar tasteful avatar twest820 avatar viceroypenguin avatar victorloktev avatar ydanila avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metadata-extractor-dotnet's Issues

Canon self timer delay presentation

Diff between Java and C# versions:

diff --git a/jpg/metadata/canon eos 5d mark ii.jpg.txt b/jpg/metadata/canon eos 5d mark ii.jpg.txt
index 00e1792..471fca3 100644
--- a/jpg/metadata/canon eos 5d mark ii.jpg.txt 
+++ b/jpg/metadata/canon eos 5d mark ii.jpg.txt 
@@ -2,7 +2,7 @@ FILE: Canon EOS 5D Mark II.jpg

 [Canon Makernote - 0xc100] Unknown tag (0xc100) = 98
 [Canon Makernote - 0xc101] Macro Mode = Normal
-[Canon Makernote - 0xc102] Self Timer Delay = 2.0 sec
+[Canon Makernote - 0xc102] Self Timer Delay = 2 sec

DirectoryTiffHandler.PushDirectory refactor

It can either take an instance, or a generic type parameter with new() constraint.

This avoids call to Activator.CreateInstance.

Instance might be best as we may add some args to certain directory ctors (offsets).

Rounding of numbers during string conversion

Java and C# round floating-point numbers differently when converting to string.

diff --git a/jpg/metadata/minolta dimage 5.jpg.txt b/jpg/metadata/minolta dimage 5.jpg.txt
index f97bf47..2896c0c 100644
--- a/jpg/metadata/minolta dimage 5.jpg.txt 
+++ b/jpg/metadata/minolta dimage 5.jpg.txt 
@@ -56,32 +56,32 @@ FILE: Minolta DiMAGE 5.jpg
 [Olympus Makernote - 0xf008] Metering Mode = Unknown (48)
 [Olympus Makernote - 0xf009] Apex Film Speed Value = 528.125
 [Olympus Makernote - 0xf00a] Apex Shutter Speed Time Value = 2.640625 sec
-[Olympus Makernote - 0xf00b] Apex Aperture Value = f/0.2
+[Olympus Makernote - 0xf00b] Apex Aperture Value = f/0.3
 [Olympus Makernote - 0xf00c] Macro Mode = Off
 [Olympus Makernote - 0xf023] Subject Program = Unknown (6)
-[Olympus Makernote - 0xf024] Flash Compensation = -0.6666666666666666 EV
+[Olympus Makernote - 0xf024] Flash Compensation = -0.666666666666667 EV
 [Olympus Makernote - 0xf025] ISO Setting = 200

PCL Support

Any thought to adding support for other platforms (like iOS and Android or even better PCL)?

Double value formatting

By default Java formats the value 1.0d as "1.0", and .NET as "1".

This means there are many descriptions that produce different output between the implementations.

For example:

diff --git a/jpg/metadata/issue 80.jpg.txt b/jpg/metadata/issue 80.jpg.txt
index 4ad1440..2b7e26d 100644
--- a/jpg/metadata/issue 80.jpg.txt 
+++ b/jpg/metadata/issue 80.jpg.txt 
@@ -23,8 +23,8 @@ FILE: Issue 80.jpg,0,768,1024) 1 Slices
-[Photoshop - 0x0428] Pixel Aspect Ratio = 1.0
+[Photoshop - 0x0428] Pixel Aspect Ratio = 1
-[ICC Profile - 0x6d656173] Measurement = 1931 2° Observer, Backing (0.0, 0.0, 0.0), Geometry Unknown, Flare 1%, Illuminant D65
+[ICC Profile - 0x6d656173] Measurement = 1931 2° Observer, Backing (0, 0, 0), Geometry Unknown, Flare 1%, Illuminant D65
-[ICC Profile - 0x0044] XYZ values = 0.9642029 1.0 0.8249054
+[ICC Profile - 0x0044] XYZ values = 0.9642029 1 0.8249054
diff --git a/jpg/metadata/minolta dimage 5.jpg.txt b/jpg/metadata/minolta dimage 5.jpg.txt
index f97bf47..2896c0c 100644
--- a/jpg/metadata/minolta dimage 5.jpg.txt 
+++ b/jpg/metadata/minolta dimage 5.jpg.txt 
@@ -56,32 +56,32 @@ FILE: Minolta DiMAGE 5.jpg
 [Olympus Makernote - 0xf00d] Digital Zoom = Unknown (6)
-[Olympus Makernote - 0xf00e] Exposure Compensation = -2.0 EV
+[Olympus Makernote - 0xf00e] Exposure Compensation = -2 EV
 [Olympus Makernote - 0xf00f] Bracket Step = 1/3 EV
 [Olympus Makernote - 0xf012] Interval Number = N/A
-[Olympus Makernote - 0xf013] Focal Length = 0.0 mm
+[Olympus Makernote - 0xf013] Focal Length = 0 mm
 [Olympus Makernote - 0xf014] Focus Distance = Infinity
 [Olympus Makernote - 0xf01c] Last File Number = 528
-[Olympus Makernote - 0xf01d] White Balance Red = 1.0
+[Olympus Makernote - 0xf01d] White Balance Red = 1
 [Olympus Makernote - 0xf01e] White Balance Green = 1.46484375
@@ -103,11 +103,11 @@ FILE: Minolta DiMAGE 5.jpg
 [ICC Profile - 0x0030] Device manufacturer = MNLT
-[ICC Profile - 0x0044] XYZ values = 0.9641876 1.0 0.8248749
+[ICC Profile - 0x0044] XYZ values = 0.9641876 1 0.8248749
 [ICC Profile - 0x0080] Tag Count = 9

Access Denied

I keep getting "Access Denied" error on the folder, imagePath. The folder and those above and below are have Administrator given full access.

the form_load handler is listed below:

    private void Form1_Load(object sender, EventArgs e)
    {
        string imagePath = "E:\\Lightroom\\_Reduced\\For Web";
            try
            {
            IEnumerable<MetadataExtractor.Directory> directories = ImageMetadataReader.ReadMetadata(imagePath);

        }
        catch (UnauthorizedAccessException ex)
            {
            throw new UnauthorizedAccessException  (ex.Message);
            }
       }
}

Sign assemblies

From the mailing list:

For SharePoint deployment I need signed DLLs ('strong named'). NuGet gives me three unsigned dlls.

With some tools it's possible to create signed DLLs, but the references within the MetadataExtractor.DLL to the dependent DLLs (like XmpCore) seems to stay as references to the unsigned ones.

Are there strong named DLLs of the MetadataExtractor and the dependent libraries available? Did anyone have a similar problem and solved it somehow?

parse error results in XMPMeta NULL

I have a picture that was face-tagged by Windows Live Photo Gallery. I would like to extract the face tag.. (Windows 8.1 app)

IEnumerable<Directory> directories = ImageMetadataReader.ReadMetadata(await imageFile.OpenStreamForReadAsync());
XmpDirectory xmpDir = (from Directory d in directories where d.Name == "XMP" select d).FirstOrDefault() as XmpDirectory;

At this point xmpDir.XmpMeta is null and the Errors enumeration contains "Error processing XMP data: Nested content not allowed with rdf:resource or property attributes".

I have attached the file so you can reproduce.

With http://www.exifviewer.org/ the XMP is correctly extracted:

Xmp.xmp.CreatorTool                          XmpText    37  Microsoft Photo Gallery 16.4.3528.331
Xmp.MP.RegionInfo                            XmpText     0  type="Struct"
Xmp.MP.RegionInfo/MPRI:Regions               XmpText     0  type="Bag"
Xmp.MP.RegionInfo/MPRI:Regions[1]            XmpText     0  type="Struct"
Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:Rectangle XmpText    38  0.403125, 0.330598, 0.192188, 0.288394
Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:PersonDisplayName XmpText    11  Bill Murray
Xmp.xmpMM.InstanceID                         XmpText    41  uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b

Any clues at which level this issue is born?
Is there another way to get the raw XMP XML?

cheers
michael

bill murray

Encoding problems in Canon makernote "Owner Name" string

diff --git a/jpg/metadata/canon ixus 750.jpg.txt b/jpg/metadata/canon ixus 750.jpg.txt
index 2fe3e71..55fcb6d 100644
--- a/jpg/metadata/canon ixus 750.jpg.txt   
+++ b/jpg/metadata/canon ixus 750.jpg.txt   
@@ -137,7 +137,7 @@ FILE: Canon IXUS 750.jpg
 [Canon Makernote - 0x0006] Image Type = IMG:DIGITAL IXUS 750 JPEG
 [Canon Makernote - 0x0007] Firmware Version = Firmware Version 1.00
 [Canon Makernote - 0x0008] Image Number = 1003892
-[Canon Makernote - 0x0009] Owner Name = Renè Glanzer
+[Canon Makernote - 0x0009] Owner Name = Ren� Glanzer
 [Canon Makernote - 0x000d] Camera Info Array = [94 values]
 [Canon Makernote - 0x0010] Canon Model ID = 26214400
diff --git a/jpg/metadata/canon powershot g11.jpg.txt b/jpg/metadata/canon powershot g11.jpg.txt
index 98eb3fb..5f23627 100644
--- a/jpg/metadata/canon powershot g11.jpg.txt  
+++ b/jpg/metadata/canon powershot g11.jpg.txt  
@@ -141,7 +141,7 @@ FILE: Canon PowerShot G11.jpg
 [Canon Makernote - 0x0006] Image Type = IMG:PowerShot G11 JPEG
 [Canon Makernote - 0x0007] Firmware Version = Firmware Version 1.00
 [Canon Makernote - 0x0008] Image Number = 4120954
-[Canon Makernote - 0x0009] Owner Name = Balázs Iván József +36304028290
+[Canon Makernote - 0x0009] Owner Name = Bal�zs Iv�n J�zsef +36304028290
 [Canon Makernote - 0x000d] Camera Info Array = [171 values]
 [Canon Makernote - 0x0010] Canon Model ID = 40894464
 [Canon Makernote - 0x0026] AF Info Array 2 = [48 values]

Photoshop resolution info diff

Diff between Java and C# versions:

diff --git a/jpg/metadata/canon eos 7d.jpg.txt b/jpg/metadata/canon eos 7d.jpg.txt
index 34ba56a..83127de 100644
--- a/jpg/metadata/canon eos 7d.jpg.txt 
+++ b/jpg/metadata/canon eos 7d.jpg.txt 
@@ -100,11 +86,11 @@ FILE: Canon EOS 7D.jpg
[JPEG - 0x0007] Component 2 = Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
[JPEG - 0x0008] Component 3 = Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert

-[Photoshop - 0x03ed] Resolution Info = 72.0x72.0 DPI
+[Photoshop - 0x03ed] Resolution Info = 72x72 DPI

ICC profile string encoding

diff --git a/jpg/metadata/multiple icc segments.jpg.txt b/jpg/metadata/multiple icc segments.jpg.txt
index c8862fb..3fb1db9 100644
--- a/jpg/metadata/multiple icc segments.jpg.txt    
+++ b/jpg/metadata/multiple icc segments.jpg.txt    
@@ -55,12 +55,12 @@ FILE: Multiple ICC segments.jpg
 [ICC Profile - 0x41324230] AToB 0 = mft2 (0x6D667432): 41478 bytes
 [ICC Profile - 0x41324232] AToB 2 = mft2 (0x6D667432): 41478 bytes
 [ICC Profile - 0x41324231] AToB 1 = mft2 (0x6D667432): 41478 bytes
-[ICC Profile - 0x42324130] BToA 0 = mft1 (0x6D667431): 145588 bytes
-[ICC Profile - 0x42324131] BToA 1 = mft1 (0x6D667431): 145588 bytes
-[ICC Profile - 0x42324132] BToA 2 = mft1 (0x6D667431): 145588 bytes
-[ICC Profile - 0x67616d74] Gamut = mft1 (0x6D667431): 37009 bytes
+[ICC Profile - 0x42324130] BToA 0 = ??? (0x0000FFFF): 145588 bytes
+[ICC Profile - 0x42324131] BToA 1 = ??? (0xD6D7D8D9): 145588 bytes
+[ICC Profile - 0x42324132] BToA 2 = ??? (0xBABBBCBD): 145588 bytes
+[ICC Profile - 0x67616d74] Gamut = ??? (0x9E9FA0A1): 37009 bytes

Reported JPEG Thumbnail Offsets are incorrect

JPEG byte offsets for embedded thumbnails are not correct. The offset is calculated relative to the segment, and does not include the offset of the segment relative to the file start. Usually, it's off by the SOI + TIFF markers or 6 + 6 = 12. This would not be true for App1 fragments in the test data since they won't contain SOI, and makes this more complicated than it seems.

Decode CFA Pattern

We currently show CFA pattern as a series of integers, for example:

[Exif SubIFD - 0x828e] CFA Pattern = 1 2 0 1

From this site, these numbers map to filter colours:

0 = Red
1 = Green
2 = Blue
3 = Cyan
4 = Magenta
5 = Yellow
6 = White

So the above example could better be described as:

[Exif SubIFD - 0x828e] CFA Pattern = Green, Blue, Red, Green

White balance mismatch

diff --git a/jpg/metadata/nikon d100.jpg.txt b/jpg/metadata/nikon d100.jpg.txt
index 363b681..c8c960d 100644
--- a/jpg/metadata/nikon d100.jpg.txt   
+++ b/jpg/metadata/nikon d100.jpg.txt   
@@ -21,7 +21,7 @@ FILE: Nikon D100.jpg
 [Exif SubIFD - 0x9204] Exposure Bias Value = 0 EV
 [Exif SubIFD - 0x9205] Max Aperture Value = f/5.7
 [Exif SubIFD - 0x9207] Metering Mode = Multi-segment
-[Exif SubIFD - 0x9208] White Balance = Cloudy
+[Exif SubIFD - 0x9208] White Balance = Flash

Also

diff --git a/jpg/metadata/nikon d1x.jpg.txt b/jpg/metadata/nikon d1x.jpg.txt
index 683fce2..2413c92 100644
--- a/jpg/metadata/nikon d1x.jpg.txt    
+++ b/jpg/metadata/nikon d1x.jpg.txt    
@@ -25,7 +25,7 @@ FILE: Nikon D1X.jpg
 [Exif SubIFD - 0x9204] Exposure Bias Value = 0 EV
 [Exif SubIFD - 0x9205] Max Aperture Value = f/2.8
 [Exif SubIFD - 0x9207] Metering Mode = Multi-segment
-[Exif SubIFD - 0x9208] White Balance = Flash
+[Exif SubIFD - 0x9208] White Balance = Unknown (4)

PowerShell support

There's currently an implementation of a PowerShell Cmdlet in the MetadataExtractor.PowerShell project. It works well enough though suggestions for extensions are welcome.

What remains to do is determine how to publish it such that it can be installed directly from the PowerShell command line. There appears to be a standard way of doing this. It may or may not require some kind of manifest to ensure dependency dlls are also included.

Another extension would be to expand all values from the XmpMeta object, rather than using the few present in XmpDirectory.

Photoshop slices/version info character encoding

Diff between Java and C# versions:

diff --git a/jpg/metadata/canon eos d60.jpg.txt b/jpg/metadata/canon eos d60.jpg.txt
index c343754..3e8c8eb 100644
--- a/jpg/metadata/canon eos d60.jpg.txt    
+++ b/jpg/metadata/canon eos d60.jpg.txt    
@@ -113,12 +92,10 @@ FILE: Canon EOS D60.jpg
[Photoshop - 0x03f8] Color Transfer Functions = [112 values]
[Photoshop - 0x0408] Grid and Guides Information = 0 0 0 1 0 0 2 64 0 0 2 64 0 0 0 0
[Photoshop - 0x041e] URL List = 0
-[Photoshop - 0x041a] Slices = polo01 (0,0,1181,1772) 1 Slices
+[Photoshop - 0x041a] Slices = 瀀漀氀漀 ㄀ (0,0,1181,1772) 1 Slices
[Photoshop - 0x0414] Seed Number = 3
-[Photoshop - 0x0421] Version Info = 1 (Adobe Photoshop, Adobe Photoshop 7.0) 1
+[Photoshop - 0x0421] Version Info = 1 (䄀搀漀戀攀 倀栀漀琀漀猀栀漀瀀, 䄀搀漀戀攀 倀栀漀琀漀猀栀漀瀀 㜀⸀ ) 1
[Photoshop - 0x0406] JPEG Quality = 3 (Low), Standard format, 3 scans

Nikon makernote "exposure difference" value

Diff between Java and C# versions:

diff --git a/jpg/metadata/nikon d610.jpg.txt b/jpg/metadata/nikon d610.jpg.txt
index 73e1db8..e944174 100644
--- a/jpg/metadata/nikon d610.jpg.txt   
+++ b/jpg/metadata/nikon d610.jpg.txt   
@@ -69,7 +69,7 @@ FILE: Nikon D610.jpg
 [Nikon Makernote - 0x000b] White Balance Fine = 0 0
 [Nikon Makernote - 0x000c] White Balance RB Coefficients = 458/256 330/256 256/256 256/256
 [Nikon Makernote - 0x000d] Program Shift = 0 EV
-[Nikon Makernote - 0x000e] Exposure Difference = -0.5 EV
+[Nikon Makernote - 0x000e] Exposure Difference = 20.83 EV
 [Nikon Makernote - 0x0011] Preview IFD = 13446

These values are quite different. Find out why and fix the broken implementation(s).

diff --git a/jpg/metadata/nikon d70.jpg.txt b/jpg/metadata/nikon d70.jpg.txt
index 8dcf2d9..ed40f03 100644
--- a/jpg/metadata/nikon d70.jpg.txt    
+++ b/jpg/metadata/nikon d70.jpg.txt    
@@ -67,7 +67,7 @@ FILE: Nikon D70.jpg
 [Nikon Makernote - 0x000b] White Balance Fine = 0
 [Nikon Makernote - 0x000c] White Balance RB Coefficients = 10242/1 34305/1 0/1 0/1
 [Nikon Makernote - 0x000d] Program Shift = 0 EV
-[Nikon Makernote - 0x000e] Exposure Difference = -1.5 EV
+[Nikon Makernote - 0x000e] Exposure Difference = 19.83 EV
 [Nikon Makernote - 0x0011] Preview IFD = 1379
 [Nikon Makernote - 0x0012] Auto Flash Compensation = 0 EV
 [Nikon Makernote - 0x0013] ISO = 0 400

Reinstate XMP DateTime tests

As discussed in #29, the XMP tests related to DateTime values are problematic.

Both TestExtract_OriginalDateTime and TestExtract_DigitizedDateTime tests have been skipped, and should be reinstated and corrected.

It seems that maybe the DateTimeOffset type would be a better fit here. That may require changes to the XmpCore project as well.

incompability of SharpZipLib dependency with Windows 8.1 apps

The compiler threw an error:
Cannot find type System.ApplicationException in module mscorlib.dll.
By installing the dependencies one-by-one, I found that this was due to SharpZipLib.
A workaround is to use the ICSharpCode.SharpZipLib.Portable package instead. (And ignoring dependencies in the NuGet package manager.)

Taking issue #48 into account, it might be time to get rid of the whole SharpZipLib dependency.

GPS tag confusion

Diff between Java output and C#:

diff --git a/jpg/metadata/apple iphone 5.jpg.txt b/jpg/metadata/apple iphone 5.jpg.txt
index 0d7f3f2..fd38bad 100644
--- a/jpg/metadata/apple iphone 5.jpg.txt   
+++ b/jpg/metadata/apple iphone 5.jpg.txt   
@@ -44,10 +44,10 @@ FILE: Apple iPhone 5.jpg

-[GPS - 0x0001] GPS Latitude Ref = N
-[GPS - 0x0002] GPS Latitude = 47° 37' 37.8"
+[GPS - 0x0001] Interoperability Index = N
+[GPS - 0x0002] Interoperability Version = 47° 37' 37.8"
 [GPS - 0x0003] GPS Longitude Ref = W
 [GPS - 0x0004] GPS Longitude = -122° 20' 14.4"
 [GPS - 0x0005] GPS Altitude Ref = Sea level

Canon camera serial number issue

Diff between Java and C# output:

diff --git a/cr2/metadata/canon eos 7d.cr2.txt b/cr2/metadata/canon eos 7d.cr2.txt
index c40588d..79d388e 100644
--- a/cr2/metadata/canon eos 7d.cr2.txt 
+++ b/cr2/metadata/canon eos 7d.cr2.txt 
@@ -91,7 +91,7 @@ FILE: Canon EOS 7D.cr2
-[Canon Makernote - 0x000c] Camera Serial Number = 006900163
+[Canon Makernote - 0x000c] Camera Serial Number = 00690163

Error decompressing ICC data from PNG file

The Java implementation got a little further, but still reported an error.

Looking into this, it seems there's a mismatch between GZip and Zlib formats here. It may be necessary to take a dependency on another library to perform this decompression.

The current code uses DeflateStream which does not handle zlib compression.

using (var inflaterStream = new DeflateStream(new MemoryStream(compressedProfile), CompressionMode.Decompress))
    yield return new IccReader().Extract(new IndexedCapturingReader(inflaterStream));

diff --git a/png/metadata/invalid-iccp-missing-adler32-checksum.png.txt b/png/metadata/invalid-iccp-missing-adler32-checksum.png.txt
index ea43bf5..e9c78f9 100644
--- a/png/metadata/invalid-iccp-missing-adler32-checksum.png.txt
+++ b/png/metadata/invalid-iccp-missing-adler32-checksum.png.txt
@@ -1,6 +1,6 @@
 FILE: invalid-iCCP-missing-adler32-checksum.png

-[ERROR: ICC Profile] Exception reading ICC profile: Unexpected end of ZLIB input stream
+[ERROR: ICC Profile] Exception reading ICC profile: Block length does not match with its complement.

 [PNG-IHDR - 0x0001] Image Width = 460
 [PNG-IHDR - 0x0002] Image Height = 60
@@ -10,34 +10,6 @@ FILE: invalid-iCCP-missing-adler32-checksum.png
 [PNG-IHDR - 0x0006] Filter Method = Adaptive
 [PNG-IHDR - 0x0007] Interlace Method = No Interlace

-[ICC Profile - 0x0000] Profile Size = 3144
-[ICC Profile - 0x0004] CMM Type = Lino
-[ICC Profile - 0x0008] Version = 2.1.0
-[ICC Profile - 0x000c] Class = Display Device
-[ICC Profile - 0x0010] Color space = RGB 
-[ICC Profile - 0x0014] Profile Connection Space = XYZ 
-[ICC Profile - 0x0018] Profile Date/Time = Mon Feb 09 06:49:00 +00:00 1998
-[ICC Profile - 0x0024] Signature = acsp
-[ICC Profile - 0x0028] Primary Platform = Microsoft Corporation
-[ICC Profile - 0x0030] Device manufacturer = IEC 
-[ICC Profile - 0x0034] Device model = sRGB
-[ICC Profile - 0x0044] XYZ values = 0.964 1 0.825
-[ICC Profile - 0x0080] Tag Count = 17
-[ICC Profile - 0x63707274] Copyright = Copyright (c) 1998 Hewlett-Packard Company
-[ICC Profile - 0x64657363] Profile Description = sRGB IEC61966-2.1
-[ICC Profile - 0x77747074] Media White Point = (0.9505, 1, 1.0891)
-[ICC Profile - 0x626b7074] Media Black Point = (0, 0, 0)
-[ICC Profile - 0x7258595a] Red Colorant = (0.4361, 0.2225, 0.0139)
-[ICC Profile - 0x6758595a] Green Colorant = (0.3851, 0.7169, 0.0971)
-[ICC Profile - 0x6258595a] Blue Colorant = (0.1431, 0.0606, 0.7141)
-[ICC Profile - 0x646d6e64] Device Mfg Description = IEC http://www.iec.ch
-[ICC Profile - 0x646d6464] Device Model Description = IEC 61966-2.1 Default RGB colour space - sRGB
-[ICC Profile - 0x76756564] Viewing Conditions Description = Reference Viewing Condition in IEC61966-2.1
-[ICC Profile - 0x76696577] Viewing Conditions = view (0x76696577): 36 bytes
-[ICC Profile - 0x6c756d69] Luminance = (76.0365, 80, 87.1246)
-[ICC Profile - 0x6d656173] Measurement = 1931 2° Observer, Backing (0, 0, 0), Geometry Unknown, Flare 1%, Illuminant D65
-[ICC Profile - 0x74656368] Technology = CRT 
-
 [PNG-iCCP - 0x000c] ICC Profile Name = Photoshop ICC profile

 [PNG-gAMA - 0x000b] Image Gamma = 0.455

Byte array presentation difference

Diff between Java and C# versions:

diff --git a/jpg/metadata/apple iphone 6 plus.jpg.txt b/jpg/metadata/apple iphone 6 plus.jpg.txt
index 63ced83..4e102a8 100644
--- a/jpg/metadata/apple iphone 6 plus.jpg.txt  
+++ b/jpg/metadata/apple iphone 6 plus.jpg.txt  
@@ -110,12 +88,12 @@ FILE: Apple iPhone 6 plus.jpg
-[Photoshop - 0x0425] Caption Digest = 1 -23 61 23 -47 7 -124 103 98 101 -88 -58 -73 34 -77 114
+[Photoshop - 0x0425] Caption Digest = 1 233 61 23 209 7 132 103 98 101 168 198 183 34 179 114

Java doesn't have unsigned bytes. Maybe adjust both libraries to write out bytes in hex, 00-FF.

The ':' character, hexadecimal value 0x3A, cannot be included in a name

XmlException with error message "The ':' character, hexadecimal value 0x3A, cannot be included in a name" is a very common exception when running ImageMetadataReader.ReadMetadata.

Example stacktrace:

   at System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType)
   at System.Xml.Linq.XName..ctor(XNamespace ns, String localName)
   at System.Xml.Linq.XNamespace.GetName(String localName)
   at System.Xml.Linq.XName.Get(String expandedName)
   at XmpCore.Impl.ParseRdf.Rdf_ResourcePropertyElement(XmpMeta xmp, XmpNode xmpParent, XElement xmlNode, Boolean isTopLevel)
   at XmpCore.Impl.ParseRdf.Rdf_PropertyElement(XmpMeta xmp, XmpNode xmpParent, XElement xmlNode, Boolean isTopLevel)
   at XmpCore.Impl.ParseRdf.Rdf_PropertyElementList(XmpMeta xmp, XmpNode xmpParent, XElement xmlParent, Boolean isTopLevel)
   at XmpCore.Impl.ParseRdf.Rdf_NodeElement(XmpMeta xmp, XmpNode xmpParent, XElement xmlNode, Boolean isTopLevel)
   at XmpCore.Impl.ParseRdf.Rdf_NodeElementList(XmpMeta xmp, XmpNode xmpParent, XElement rdfRdfNode)
   at XmpCore.Impl.ParseRdf.Rdf_RDF(XmpMeta xmp, XElement rdfRdfNode)
   at XmpCore.Impl.XmpMetaParser.ParseXmlDoc(XDocument document, ParseOptions options)
   at XmpCore.Impl.XmpMetaParser.Parse(Byte[] bytes, ParseOptions options)
   at MetadataExtractor.Formats.Xmp.XmpReader.Extract(Byte[] xmpBytes)
   at MetadataExtractor.Formats.Xmp.XmpReader.ReadJpegSegments(IEnumerable`1 segments, JpegSegmentType segmentType)
   at MetadataExtractor.Formats.Jpeg.JpegMetadataReader.<>c.<ProcessJpegSegments>b__4_4(<>f__AnonymousType1`2 <>h__TransparentIdentifier1)
   at System.Linq.Enumerable.<SelectManyIterator>d__22`3.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at MetadataExtractor.Formats.Jpeg.JpegMetadataReader.ProcessJpegSegments(IEnumerable`1 readers, IEnumerable`1 segments)
   at MetadataExtractor.Formats.Jpeg.JpegMetadataReader.Process(Stream stream, IEnumerable`1 readers)
   at MetadataExtractor.ImageMetadataReader.ReadMetadata(Stream stream)

XMP when exception above:

<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description rdf:about="uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b" xmlns:dc="http://purl.org/dc/elements/1.1/"/>
    <rdf:Description rdf:about="uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b" xmlns:xmp="http://ns.adobe.com/xap/1.0/">
      <xmp:CreateDate>2016-06-15T08:38:12.946</xmp:CreateDate>
    </rdf:Description>
    <rdf:Description rdf:about="uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b" xmlns:dc="http://purl.org/dc/elements/1.1/">
      <dc:creator>
        <rdf:Seq xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
          <rdf:li>xxx</rdf:li>
        </rdf:Seq>
      </dc:creator>
    </rdf:Description>
  </rdf:RDF>
</x:xmpmeta>

It would be nice to be able to get other metadata even if XMP in invalid.

Support editing metadata

Hi, this looks fantastic. Can it also edit and save metadata to files? Or just read? If not, can you recommend any c# library for writing metadata? (description, comments, tags)
Thnaks

Support earlier versions of .NET

As pointed out by @vanhelgin on Stack Overflow, this library currently requires .NET 4.5 or later.

The primary reason for this is the use of the handy IReadOnlyList<T> interface.

Investigate dual-targeting this project to give 3.5+ and 4.5+ options for users.

Null value formatting

Some Java code converts a null value into the string "null", where .NET produces an empty string.

Make both implementations produce identical output in such cases.

diff --git a/jpg/metadata/leica c (typ 112).jpg.txt b/jpg/metadata/leica c (typ 112).jpg.txt
index 94938f1..0b46d13 100644
--- a/jpg/metadata/leica c (typ 112).jpg.txt    
+++ b/jpg/metadata/leica c (typ 112).jpg.txt    
@@ -84,7 +84,7 @@ FILE: Leica C (Typ 112).jpg
 [Panasonic Makernote - 0x0032] Color Mode = Normal
-[Panasonic Makernote - 0x0033] Baby Age = null
+[Panasonic Makernote - 0x0033] Baby Age = 
 [Panasonic Makernote - 0x0034] Optical Zoom Mode = Standard
@@ -100,24 +100,24 @@ FILE: Leica C (Typ 112).jpg
 [Panasonic Makernote - 0x004d] Af Point Position = 128/256 128/256
-[Panasonic Makernote - 0x004e] Face Detection Info = null
+[Panasonic Makernote - 0x004e] Face Detection Info = 
 [Panasonic Makernote - 0x004f] Unknown tag (0x004f) = 0
@@ -166,7 +166,7 @@ FILE: Leica C (Typ 112).jpg
 [Panasonic Makernote - 0x8009] Text Stamp 3 = Off
-[Panasonic Makernote - 0x8010] Baby Age 1 = null
+[Panasonic Makernote - 0x8010] Baby Age 1 = 
diff --git a/jpg/metadata/nikon d300.jpg.txt b/jpg/metadata/nikon d300.jpg.txt
index ed307a3..fd32c20 100644
--- a/jpg/metadata/nikon d300.jpg.txt   
+++ b/jpg/metadata/nikon d300.jpg.txt   
@@ -109,10 +109,10 @@ FILE: Nikon D300.jpg
 [Nikon Makernote - 0x00b1] High ISO Noise Reduction = Normal
-[Nikon Makernote - 0x00b6] Power Up Time = null
+[Nikon Makernote - 0x00b6] Power Up Time = 
diff --git a/jpg/metadata/nikon d3100.jpg.txt b/jpg/metadata/nikon d3100.jpg.txt
index 78aa160..a024420 100644
--- a/jpg/metadata/nikon d3100.jpg.txt  
+++ b/jpg/metadata/nikon d3100.jpg.txt  
@@ -74,7 +74,7 @@ FILE: Nikon D3100.jpg
 [Nikon Makernote - 0x0013] ISO = 0 400
 [Nikon Makernote - 0x0016] Image Boundary = 0 0 4608 3072
 [Nikon Makernote - 0x0017] Flash Exposure Compensation = 0 EV
-[Nikon Makernote - 0x0018] Flash Bracket Compensation = null
+[Nikon Makernote - 0x0018] Flash Bracket Compensation = 

ICC parsing is broken

Run master against the sample images and notice ICC data is scrambled. Probably just misaligned at some point.

Exception processing TIFF file

diff --git a/tif/metadata/issue 16.tif.txt b/tif/metadata/issue 16.tif.txt
index 9dd2fea..e58beb4 100644
--- a/tif/metadata/issue 16.tif.txt 
+++ b/tif/metadata/issue 16.tif.txt 
@@ -1,60 +1,6 @@
 FILE: Issue 16.tif

-[Exif IFD0 - 0x00fe] New Subfile Type = Unknown (0)
-[Exif IFD0 - 0x0100] Image Width = 728 pixels
-[Exif IFD0 - 0x0101] Image Height = 825 pixels
-[Exif IFD0 - 0x0102] Bits Per Sample = 8 8 8 bits/component/pixel
-[Exif IFD0 - 0x0103] Compression = Uncompressed
-[Exif IFD0 - 0x0106] Photometric Interpretation = RGB
-[Exif IFD0 - 0x010f] Make = Phase One
-[Exif IFD0 - 0x0110] Model = P 45+
-[Exif IFD0 - 0x0111] Strip Offsets = 47096
-[Exif IFD0 - 0x0112] Orientation = Top, left side (Horizontal / normal)
-[Exif IFD0 - 0x0115] Samples Per Pixel = 3 samples/pixel
-[Exif IFD0 - 0x0116] Rows Per Strip = 825 rows/strip
-[Exif IFD0 - 0x0117] Strip Byte Counts = 1801800 bytes
-[Exif IFD0 - 0x011a] X Resolution = 300 dots per inch
-[Exif IFD0 - 0x011b] Y Resolution = 300 dots per inch
-[Exif IFD0 - 0x011c] Planar Configuration = Chunky (contiguous for each subsampling pixel)
-[Exif IFD0 - 0x0128] Resolution Unit = Inch
-[Exif IFD0 - 0x0131] Software = Adobe Photoshop CS3 Macintosh
-[Exif IFD0 - 0x0132] Date/Time = 2013:05:15 09:42:30
-[Exif IFD0 - 0x013b] Artist = Eric Piasecki Photography LLC
-[Exif IFD0 - 0x02bc] Unknown tag (0x02bc) = [29183 values]
-[Exif IFD0 - 0x8298] Copyright = © 2010 Eric Piasecki
-[Exif IFD0 - 0x8649] Unknown tag (0x8649) = [14098 values]
-[Exif IFD0 - 0x8773] Inter Color Profile = [3144 values]
-
-[IPTC - 0x015a] Coded Character Set = UTF-8
-[IPTC - 0x0200] Application Record Version = 4
-[IPTC - 0x0250] By-line = Eric Piasecki Photography LLC
-[IPTC - 0x0237] Date Created = Mon Nov 30 00:00:00 +00:00 2009
-[IPTC - 0x025a] City = New York
-[IPTC - 0x025f] Province/State = NY
-[IPTC - 0x0265] Country/Primary Location Name = USA
-[IPTC - 0x0219] Keywords = apt;color;kureck jones;moroccan;vivid
-[IPTC - 0x0274] Copyright Notice = © 2010 Eric Piasecki
-[IPTC - 0x023e] Digital Date Created = 20100930
-[IPTC - 0x023f] Digital Time Created = 16:06:06-0400
-
-[Exif SubIFD - 0x829a] Exposure Time = 1/6 sec
-[Exif SubIFD - 0x8822] Exposure Program = Manual control
-[Exif SubIFD - 0x8827] ISO Speed Ratings = 100
-[Exif SubIFD - 0x9000] Exif Version = 2.30
-[Exif SubIFD - 0x9003] Date/Time Original = 2010:09:30 16:06:06
-[Exif SubIFD - 0x9004] Date/Time Digitized = 2010:09:30 16:06:06
-[Exif SubIFD - 0x9201] Shutter Speed Value = 1/6 sec
-[Exif SubIFD - 0x9204] Exposure Bias Value = 0 EV
-[Exif SubIFD - 0x9208] White Balance = (Other)
-[Exif SubIFD - 0xa001] Color Space = sRGB
-[Exif SubIFD - 0xa002] Exif Image Width = 728 pixels
-[Exif SubIFD - 0xa003] Exif Image Height = 825 pixels
-[Exif SubIFD - 0xa300] File Source = Digital Still Camera (DSC)
-[Exif SubIFD - 0xa301] Scene Type = Directly photographed image
-
-[File - 0x0001] File Name = Issue 16.tif
-[File - 0x0002] File Size = 1849136 bytes
-[File - 0x0003] File Modified Date = <omitted for regression testing as checkout dependent>
+EXCEPTION: Year, Month, and Day parameters describe an un-representable DateTime.

 Generated using metadata-extractor
 https://drewnoakes.com/code/exif/

New file type: Olympus "MMOR\0\0"

I found a file with an unsupported type and could extend the code to read it. It's one of the Olympus RAW files from here: http://www.rawsamples.ch/index.php/en/olympus (Unfortunately I don't know which anymore).

Patch MetadataExtractor/Util/FileTypeDetector.cs to add this line:

_root.AddPath(FileType.Orf, Encoding.UTF8.GetBytes("MMOR"), new byte[] { 0x00, 0x00 });

Error parsing ICC date

diff --git a/jpg/metadata/nikon e5700.jpg.txt b/jpg/metadata/nikon e5700.jpg.txt
index 047d70e..5749d52 100644
--- a/jpg/metadata/nikon e5700.jpg.txt  
+++ b/jpg/metadata/nikon e5700.jpg.txt  
@@ -1,5 +1,7 @@
 FILE: Nikon E5700.jpg

+[ERROR: ICC Profile] Exception reading ICC profile: Year, Month, and Day parameters describe an un-representable DateTime.
+
 [JPEG - 0xfffffffd] Compression Type = Baseline
 [JPEG - 0x0000] Data Precision = 8 bits
 [JPEG - 0x0001] Image Height = 2560 pixels
@@ -78,22 +80,6 @@ FILE: Nikon E5700.jpg
 [ICC Profile - 0x000c] Class = Display Device
 [ICC Profile - 0x0010] Color space = RGB 
 [ICC Profile - 0x0014] Profile Connection Space = XYZ 
-[ICC Profile - 0x0018] Profile Date/Time = Sat Jan 08 14:40:30 +00:00 2000
-[ICC Profile - 0x0024] Signature = acsp
-[ICC Profile - 0x0028] Primary Platform = Apple Computer, Inc.
-[ICC Profile - 0x0030] Device manufacturer = none
-[ICC Profile - 0x0034] Device model = 1
-[ICC Profile - 0x0044] XYZ values = 0.9642029 1.0 0.8249054
-[ICC Profile - 0x0080] Tag Count = 9
-[ICC Profile - 0x64657363] Profile Description = Nikon sRGB 4.0.0.3000
-[ICC Profile - 0x7258595a] Red Colorant = (0.43607, 0.2225, 0.01392)
-[ICC Profile - 0x6758595a] Green Colorant = (0.38507, 0.71687, 0.09706)
-[ICC Profile - 0x6258595a] Blue Colorant = (0.14305, 0.06061, 0.71399)
-[ICC Profile - 0x72545243] Red TRC = 0.0085908
-[ICC Profile - 0x67545243] Green TRC = 0.0085908
-[ICC Profile - 0x62545243] Blue TRC = 0.0085908
-[ICC Profile - 0x77747074] Media White Point = (0.9505, 1.0, 1.0891)
-[ICC Profile - 0x63707274] Copyright = Nikon Inc. & Nikon Corporation 2001

 [File - 0x0001] File Name = Nikon E5700.jpg
 [File - 0x0002] File Size = 2046784 bytes

Date formats?

Using GpsDirectory.TagDateStamp i get date formats like
"GPS - GPS Date Stamp - 2016-03-14"
and also
"GPS - GPS Date Stamp - 2016:03:18"

why am i seeing different formats?

zTXt Compressed textual data

Hi, your neat library doesn't seem to support zTXt chunks. I'm currently forking and implementing zTXt support, and I was wondering if you had made any progress, or have any recommendations on possibly the use of alternate libs etc.

XMP parsing fails

[ERROR: Xmp] Error processing XMP data: Empty schema namespace URI

VS2013 build issues

Hello. Does building in VS2013 or better require Resharper to be installed? I don't have it and there are all kinds of compilation problems, such as:

[Pure]
public static bool IsValidDate(int year, int month, int day)
        => year >= 1 && year <= 9999 &&
           month >= 1 && month <= 12 &&
           day >= 1 && day <= DateTime.DaysInMonth(year, month);

Thanks

XmlException on parsing Xmp

Hi all,

We notice a problem while parsing some photos. As I understand, these cameras create strange XML inside the Xmp Tags - but probably it's easier to find a workaround inside the code than motivate all customers to use a proper camera :)

Is this issue already known? Would you consider to have a look in it?
Else I will try to find time to prepare a draft of a pull request.

Thanks for a short feedback, Adrian

Exception Message in Xmp Parsing
The ':' character, hexadecimal value 0x3A, cannot be included in a name.

Sample Images:

familie042
familie041

System.Xml.XmlException occurred
  HResult=-2146232000
  LineNumber=0
  LinePosition=3
  Message=The ':' character, hexadecimal value 0x3A, cannot be included in a name.
  Source=System.Xml
  StackTrace:
       at System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType)
       at System.Xml.Linq.XName..ctor(XNamespace ns, String localName)
       at System.Xml.Linq.XNamespace.GetName(String localName)
       at System.Xml.Linq.XName.Get(String expandedName)
       at XmpCore.Impl.ParseRdf.Rdf_ResourcePropertyElement(XmpMeta xmp, XmpNode xmpParent, XElement xmlNode, Boolean isTopLevel)
       at XmpCore.Impl.ParseRdf.Rdf_PropertyElement(XmpMeta xmp, XmpNode xmpParent, XElement xmlNode, Boolean isTopLevel)
       at XmpCore.Impl.ParseRdf.Rdf_PropertyElementList(XmpMeta xmp, XmpNode xmpParent, XElement xmlParent, Boolean isTopLevel)
       at XmpCore.Impl.ParseRdf.Rdf_NodeElement(XmpMeta xmp, XmpNode xmpParent, XElement xmlNode, Boolean isTopLevel)
       at XmpCore.Impl.ParseRdf.Rdf_NodeElementList(XmpMeta xmp, XmpNode xmpParent, XElement rdfRdfNode)
       at XmpCore.Impl.ParseRdf.Rdf_RDF(XmpMeta xmp, XElement rdfRdfNode)
       at XmpCore.Impl.XmpMetaParser.ParseXmlDoc(XDocument document, ParseOptions options)
       at XmpCore.Impl.XmpMetaParser.Parse(Byte[] bytes, ParseOptions options)
       at MetadataExtractor.Formats.Xmp.XmpReader.Extract(Byte[] xmpBytes)
       at MetadataExtractor.Formats.Xmp.XmpReader.ReadJpegSegments(IEnumerable`1 segments, JpegSegmentType segmentType)
       at MetadataExtractor.Formats.Jpeg.JpegMetadataReader.<>c.<ProcessJpegSegments>b__4_4(<>f__AnonymousType1`2 <>h__TransparentIdentifier1)
       at System.Linq.Enumerable.<SelectManyIterator>d__22`3.MoveNext()
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at MetadataExtractor.Formats.Jpeg.JpegMetadataReader.ProcessJpegSegments(IEnumerable`1 readers, IEnumerable`1 segments)
       at MetadataExtractor.Formats.Jpeg.JpegMetadataReader.Process(Stream stream, IEnumerable`1 readers)
       at MetadataExtractor.ImageMetadataReader.ReadMetadata(Stream stream)
...

Epson PhotoPC image missing several directories

Diff between Java and C# versions:

diff --git a/jpg/metadata/epson photopc 3000z.jpg.txt b/jpg/metadata/epson photopc 3000z.jpg.txt
index 35cb037..9c7af1a 100644
--- a/jpg/metadata/epson photopc 3000z.jpg.txt  
+++ b/jpg/metadata/epson photopc 3000z.jpg.txt  
@@ -48,32 +48,5 @@ FILE: Epson PhotoPC 3000Z.jpg
 [Exif SubIFD - 0xa300] File Source = Digital Still Camera (DSC)
 [Exif SubIFD - 0xa301] Scene Type = Directly photographed image

-[Olympus Makernote - 0x0200] Special Mode = Unknown picture taking mode / 208th in a sequence
-[Olympus Makernote - 0x0201] JPEG Quality = Super High Quality
-[Olympus Makernote - 0x0202] Macro = Macro
-[Olympus Makernote - 0x0203] BW Mode = Off
-[Olympus Makernote - 0x0204] DigiZoom Ratio = Unknown (1)
-[Olympus Makernote - 0x0209] Camera Id = EPSON DIGITAL CAMERA
-[Olympus Makernote - 0x020a] Unknown tag (0x020a) = [512 values]
-[Olympus Makernote - 0x020b] Image Width = 2048
-[Olympus Makernote - 0x020c] Image Height = 1536
-[Olympus Makernote - 0x020d] Original Manufacturer Model = SX321
-[Olympus Makernote - 0x0300] Pre Capture Frames = 0
-[Olympus Makernote - 0x0f00] Data Dump = [174 values]
-
-[Interoperability - 0x0001] Interoperability Index = Recommended Exif Interoperability Rules (ExifR98)
-[Interoperability - 0x0002] Interoperability Version = 1.00
-
-[Exif Thumbnail - 0x0103] Compression = JPEG (old-style)
-[Exif Thumbnail - 0x011a] X Resolution = 72 dots per inch
-[Exif Thumbnail - 0x011b] Y Resolution = 72 dots per inch
-[Exif Thumbnail - 0x0128] Resolution Unit = Inch
-[Exif Thumbnail - 0x0201] Thumbnail Offset = 4084 bytes
-[Exif Thumbnail - 0x0202] Thumbnail Length = 4700 bytes
-
-[File - 0x0001] File Name = Epson PhotoPC 3000Z.jpg
-[File - 0x0002] File Size = 744723 bytes
-[File - 0x0003] File Modified Date = Sun Jan 27 02:31:15 +00:00 2013

XMP rating presentation difference

Diff between Java and C# versions:

diff --git a/jpg/metadata/apple iphone 6 plus.jpg.txt b/jpg/metadata/apple iphone 6 plus.jpg.txt
index 63ced83..4e102a8 100644
--- a/jpg/metadata/apple iphone 6 plus.jpg.txt  
+++ b/jpg/metadata/apple iphone 6 plus.jpg.txt  
@@ -110,12 +88,12 @@ FILE: Apple iPhone 6 plus.jpg
-[Xmp - 0x1001] Rating = 2.0
+[Xmp - 0x1001] Rating = 2

Excessive bounds checking when reading multi-byte values

For example, ByteArrayReader.GetInt32 validates the index for four bytes. It then calls GetByte four times, which causes a further four validations.

One potential solution is to have a non-public GetByteInternal method that doesn't validate.

Investigate at the same time whether we can have the GetByte calls be inlined. Being virtual probably nixes that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.