From 2cd0650d381ac988e82d2f6f9eb9358098979db6 Mon Sep 17 00:00:00 2001 From: Ozgur Ozcitak Date: Fri, 6 Sep 2019 11:52:10 +0300 Subject: [PATCH] Add quick start documentation to read me. --- ExifLibrary/ExifProperty.cs | 4 +-- README.md | 54 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/ExifLibrary/ExifProperty.cs b/ExifLibrary/ExifProperty.cs index 90bc154..7415a90 100644 --- a/ExifLibrary/ExifProperty.cs +++ b/ExifLibrary/ExifProperty.cs @@ -647,7 +647,7 @@ public override ExifInterOperability Interoperability } /// - /// Represents a 16-bit signed integer. (EXIF Specification: SHORT) + /// Represents a 16-bit signed integer. (EXIF Specification: SSHORT) /// public class ExifSShort : ExifProperty { @@ -676,7 +676,7 @@ public override ExifInterOperability Interoperability /// /// Represents an array of 16-bit signed integers. - /// (EXIF Specification: SHORT with count > 1) + /// (EXIF Specification: SSHORT with count > 1) /// public class ExifSShortArray : ExifProperty { diff --git a/README.md b/README.md index 14b432b..b10750b 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,57 @@ [![AppVeyor](https://img.shields.io/appveyor/ci/oozcitak/exiflibrary.svg?style=flat-square)](https://ci.appveyor.com/project/oozcitak/exiflibrary) ExifLibrary is a .Net Standard library for editing Exif metadata contained in image files. + +# Installation # + +If you are using [NuGet](https://nuget.org/) you can install the assembly with: + +`PM> Install-Package ExifLibNet` + +# Quick Start # + +To read an image file and extract metadata: + +```cs +var file = ImageFile.FromFile('path_to_image'); +// metadata.Properties is a collection of image metadata +foreach (var item in file.Properties) +{ + if (item.Tag == ExifTag.ISOSpeedRatings) + { + var isoTag = item as ExifUShort; + // the type of Value is unsigned short + // see documentation for tag data types + ushort iso = isoTag.Value; + } + else if (item.Tag == ExifTag.Flash) + { + var flashTag = item as ExifEnumProperty; + // Value is an enum property + Flash flash = flashTag.Value; + } + else if (item.Tag == ExifTag.GPSLatitude) + { + var latTag = item as GPSLatitudeLongitude; + // Value contains three rational numbers + // representing degrees/minutes/seconds + // of the latitude + MathEx.UFraction32[] lat = latTag.Value; + } +} +``` + +To add metadata: + +```cs +var file = ImageFile.FromFile('path_to_image'); +file.Properties.Add(ExifTag.ISOSpeedRatings, 200); + +``` + +To save the image with metadata: + +```cs + +file.Save('path_to_image'); +```