Process Complex EXIF Types
View as MarkdownReads and writes complex EXIF tags.
Code Snippet
using (var jpegReader = new JpegReader("Chicago.jpg"))
using (var jpegWriter = new JpegWriter("ProcessComplexExifTypes.jpg", 70))
{
var exif = new ExifDictionary(jpegReader.Exif);
object[] latitude = null;
if (exif.Contains(ExifDictionary.GpsLatitude))
{
latitude = exif.GetItemArray(ExifDictionary.GpsLatitude);
latitude[0] = new UnsignedRational(113, 12);
}
else
{
// Alexandria, Virginia
latitude = new object[] { new UnsignedRational(38, 1), new UnsignedRational(48, 1), new UnsignedRational(17, 1) };
}
exif.SetItemArray(ExifDictionary.GpsLatitude, latitude);
var gpsVer = new object[] { (byte)2, (byte)0, (byte)0, (byte)1 };
exif.SetItemArray(ExifDictionary.GpsVersionId, gpsVer);
exif[ExifDictionary.Software] = "Aurigma Graphics Mill";
jpegWriter.Exif = exif;
Pipeline.Run(jpegReader + jpegWriter);
}
Input
Chicago.jpg
Output
WriteExifIptcMemoryFriendly.jpg
DownloadUsed APIs
- Aurigma.GraphicsMill.Codecs.ExifDictionary
- Aurigma.GraphicsMill.Codecs.ImageReader.Exif
- Aurigma.GraphicsMill.Codecs.JpegReader
- Aurigma.GraphicsMill.Codecs.JpegWriter
- Aurigma.GraphicsMill.Codecs.JpegWriter.Exif
- Aurigma.GraphicsMill.Codecs.MetadataDictionary.Contains(Object)
- Aurigma.GraphicsMill.Codecs.MetadataDictionary.GetItemArray(Object)
- Aurigma.GraphicsMill.Codecs.MetadataDictionary.SetItemArray(Object,Object[])
- Aurigma.GraphicsMill.UnsignedRational