---
title: "Process Complex EXIF Types"
canonical: https://www.graphicsmill.com/samples/Metadata/EXIFAndIPTC/ProcessComplexExifTypes_cs
product: "Graphics Mill"
source: "Metadata/EXIFAndIPTC/ProcessComplexExifTypes.cs"
---

# Process Complex EXIF Types

Reads and writes complex EXIF tags.

## Instruction

Modify EXIF data of a JPEG image, specifically GPS latitude and version information, and save the updated image with the new EXIF metadata.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
```

## Code Snippet

```csharp
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);
}
```

## Explanation

The code:

- Reads the input JPEG image.
- Retrieves and modifies the EXIF data, including setting a new GPS latitude and version information.
- Updates the EXIF metadata to include "Aurigma Graphics Mill" in the Software field.
- Saves the modified image with the updated EXIF metadata to the specified output file.

## Tags

- [EXIF](<https://www.graphicsmill.com/samples/tags/exif_md>): Managing EXIF metadata
- [Read](<https://www.graphicsmill.com/samples/tags/read_md>): Reading images with codecs
- [Write](<https://www.graphicsmill.com/samples/tags/write_md>): Writing images with codecs

## Input

- [Chicago.jpg](<https://www.graphicsmill.com/samples/Metadata/compiled/Debug/Chicago_jpg>) (preview)

## Output

- [WriteExifIptcMemoryFriendly.jpg](<https://www.graphicsmill.com/samples/Metadata/compiled/Debug/WriteExifIptcMemoryFriendly_jpg>) (download)

## Used APIs

- [Aurigma.GraphicsMill.Codecs.ExifDictionary](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_ExifDictionary.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageReader.Exif](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_ImageReader_Exif.htm.md>)
- [Aurigma.GraphicsMill.Codecs.JpegReader](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_JpegReader.htm.md>)
- [Aurigma.GraphicsMill.Codecs.JpegWriter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_JpegWriter.htm.md>)
- [Aurigma.GraphicsMill.Codecs.JpegWriter.Exif](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_JpegWriter_Exif.htm.md>)
- [Aurigma.GraphicsMill.Codecs.MetadataDictionary.Contains(Object)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_MetadataDictionary_Contains_1_d02429b3.htm.md>)
- [Aurigma.GraphicsMill.Codecs.MetadataDictionary.GetItemArray(Object)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_MetadataDictionary_GetItemArray_1_d02429b3.htm.md>)
- [Aurigma.GraphicsMill.Codecs.MetadataDictionary.SetItemArray(Object,Object\[\])](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_MetadataDictionary_SetItemArray_2_65aeff2b.htm.md>)
- [Aurigma.GraphicsMill.UnsignedRational](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_UnsignedRational.htm.md>)
