---
title: "Loading or Saving EXIF and IPTC Metadata"
canonical: https://www.graphicsmill.com/docs/gm5/LoadingEXIFandIPTCMetadata.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# Loading or Saving EXIF and IPTC Metadata
 
Some image file formats allow storing not only image itself, but also some additional information about the image. This additional data is called metadata. Graphics Mill for .NET supports three kinds of metadata: EXIF, IPTC, and XMP. The latter type is described in a separate article.
 
EXIF stands for **Ex**changeable **I**mage **F**ile format. It is usually written by digital cameras and other capturing devices, and stores such details as information about the input device, capturing parameters, date of capturing, etc (these details vary depending on the devices). It even can keep GPS information (if capturing device have a GPS module). An especially useful feature of the EXIF format is that it usually stores a thumbnail created by the capturing device. That allows an extremely fast displaying of a file thumbnail.
 
IPTC is an abbreviation of **I**nternational **P**ress **T**elecommunications **C**ouncil—an organization that develops industry standards for the interchange of news data. IPTC metadata format was developed to store extra details about the image for journalistic needs. So, it stores such details as author name, by-line, description, location, keywords, etc.
 
## Reading EXIF and IPTC Metadata
  
In Graphics Mill for .NET, you can get metadata through classes from the [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md) namespace called *format readers*. All format readers that support metadata implement the [IMetadataReadSupport](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IMetadataReadSupport.htm.md) interface which exposes the [Exif](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_IMetadataReadSupport_Exif.htm.md) and [Iptc](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_IMetadataReadSupport_Iptc.htm.md) properties. These properties return [ExifDictionary](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_ExifDictionary.htm.md) and [IptcDictionary](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IptcDictionary.htm.md) collections that provide access to the metadata.
 
The code below demonstrates how to extract and display both EXIF and IPTC data.
 
```
Dim bitmap As New Aurigma.GraphicsMill.Bitmap

'Read bitmap and metadata
Dim jpegReader As New Aurigma.GraphicsMill.Codecs.JpegReader("C:\IMG_0001.jpg")

'Read metadata
Dim exif As Aurigma.GraphicsMill.Codecs.ExifDictionary = jpegReader.Exif
Dim iptc As Aurigma.GraphicsMill.Codecs.IptcDictionary = jpegReader.Iptc

'Read bitmap
Dim frame As Aurigma.GraphicsMill.Codecs.Frame = jpegReader.LoadFrame(0)
frame.GetBitmap(bitmap)

frame.Dispose()

jpegReader.Dispose()

'Show EXIF tags
If Not exif Is Nothing Then
    Console.WriteLine("EXIF")
    Console.WriteLine("---------------")
    For Each key As Long In exif.Keys
        Console.WriteLine("{0}: {1}, {2}", exif.GetKeyDescription(key), _
         exif.Item(key), exif.GetItemString(key))
    Next
End If

'Show IPTC tags
If Not iptc Is Nothing Then
    Console.WriteLine("IPTC")
    Console.WriteLine("---------------")
    For Each key As Long In iptc.Keys
        Console.WriteLine("{0}: {1}, {2}", iptc.GetKeyDescription(key), _
         iptc.Item(key), iptc.GetItemString(key))
    Next
End If

'Process bitmap...
bitmap.Transforms.RotateAndFlip(System.Drawing.RotateFlipType.Rotate90FlipNone)

'...
```
 
```csharp
using (Aurigma.GraphicsMill.Bitmap bitmap =
    new Aurigma.GraphicsMill.Bitmap())
{
    //Read bitmap and metadata
    Aurigma.GraphicsMill.Codecs.ExifDictionary exif = null;
    Aurigma.GraphicsMill.Codecs.IptcDictionary iptc = null;

    using (Aurigma.GraphicsMill.Codecs.JpegReader jpegReader =
        new Aurigma.GraphicsMill.Codecs.JpegReader(@"C:\IMG_0001.jpg"))
    {
        //Read metadata
        exif = jpegReader.Exif;
        iptc = jpegReader.Iptc;

        //Read bitmap
        using (Aurigma.GraphicsMill.Codecs.IFrame frame = jpegReader.LoadFrame(0))
        {
            frame.GetBitmap(bitmap);
        }
    }
    //Show EXIF tags
    if (exif != null)
    {
        Console.WriteLine("EXIF");
        Console.WriteLine("---------------");
        foreach (long key in exif.Keys)
        {
            Console.WriteLine("{0}: {1}, {2}", exif.GetKeyDescription(key),
                exif[key], exif.GetItemString(key));
        }
    }

    //Show IPTC tags
    if (iptc != null)
    {
        Console.WriteLine("IPTC");
        Console.WriteLine("---------------");
        foreach (long key in iptc.Keys)
        {
            Console.WriteLine("{0}: {1}, {2}", iptc.GetKeyDescription(key),
                iptc[key], iptc.GetItemString(key));
        }
    }

    //Process bitmap...
    bitmap.Transforms.RotateAndFlip(System.Drawing.RotateFlipType.Rotate90FlipNone);

    //...
}
```
 
Currently Graphics Mill for .NET can read three formats that support EXIF and IPTC information: [JPEG](https://www.graphicsmill.com/docs/gm5/JPEGFileFormat.htm.md), [TIFF](https://www.graphicsmill.com/docs/gm5/TIFFFileFormat.htm.md), and [PSD](https://www.graphicsmill.com/docs/gm5/PSDFileFormat.htm.md).
 
## Saving EXIF and IPTC Metadata
  
Graphics Mill for .NET allows not only reading EXIF and IPTC metadata, but also modify and write it with the file. There are two ways to do it.
 
The first way is to use *format writers*. Format writers that support metadata implement the [IMetadataWriteSupport](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IMetadataWriteSupport.htm.md) interface. This interface exposes two properties: [Exif](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_IMetadataWriteSupport_Exif.htm.md) and [Iptc](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_IMetadataWriteSupport_Iptc.htm.md). You can pass an ExifDictionary or IptcDictionary instance to the corresponding property, and therefore provide your metadata.
 
This code example demonstrates how to add few EXIF and IPTC fields into the image.
 
```
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("C:\mountain.jpg")

'Write bitmap and metadata
Dim jpegWriter As New Aurigma.GraphicsMill.Codecs.JpegWriter("C:\result.jpg")

'Write metadata
Dim exif As New Aurigma.GraphicsMill.Codecs.ExifDictionary
exif.Item(Aurigma.GraphicsMill.Codecs.ExifDictionary.Software) = "Aurigma Graphics Mill"
jpegWriter.Exif = exif

Dim iptc As New Aurigma.GraphicsMill.Codecs.IptcDictionary
iptc.Item(Aurigma.GraphicsMill.Codecs.IptcDictionary.Keyword) = "mountain"
iptc.Item(Aurigma.GraphicsMill.Codecs.IptcDictionary.City) = "Olympia"
jpegWriter.Iptc = iptc

'Write bitmap
Dim frame2 As New Aurigma.GraphicsMill.Codecs.JpegFrame(bitmap, 70, False)
jpegWriter.AddFrame(frame2)

jpegWriter.Dispose()

bitmap.Dispose()
```
 
```csharp
using (Aurigma.GraphicsMill.Bitmap bitmap =
    new Aurigma.GraphicsMill.Bitmap(@"C:\mountain.jpg"))
{
    //Write bitmap and metadata
    using (Aurigma.GraphicsMill.Codecs.JpegWriter jpegWriter =
               new Aurigma.GraphicsMill.Codecs.JpegWriter(@"C:\result.jpg"))
    {
        //Write metadata
        Aurigma.GraphicsMill.Codecs.ExifDictionary exif =
            new Aurigma.GraphicsMill.Codecs.ExifDictionary();
        exif[Aurigma.GraphicsMill.Codecs.ExifDictionary.Software] = "Aurigma Graphics Mill";
        jpegWriter.Exif = exif;

        Aurigma.GraphicsMill.Codecs.IptcDictionary iptc =
            new Aurigma.GraphicsMill.Codecs.IptcDictionary();
        iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Keyword] = "mountain";
        iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.City] = "Olympia";
        jpegWriter.Iptc = iptc;

        //Write bitmap
        using (Aurigma.GraphicsMill.Codecs.JpegFrame frame2 =
                   new Aurigma.GraphicsMill.Codecs.JpegFrame(bitmap, 70, false))
        {
            jpegWriter.AddFrame(frame2);
        }
    }
}
```
 
Alternatively, you can put EXIF and IPTC metadata into encoder options of the formats that support it, and pass it to the [Save](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Bitmap_Save.htm.md) method of the [Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md) class. Here is an example of this approach (doing the same as the code above):
 
```
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("C:\mountain.jpg")

Dim encoderOptions As New Aurigma.GraphicsMill.Codecs.JpegEncoderOptions(70, False)

Dim exif As New Aurigma.GraphicsMill.Codecs.ExifDictionary
exif.Item(Aurigma.GraphicsMill.Codecs.ExifDictionary.Software) = "Aurigma Graphics Mill"
encoderOptions.Exif = exif

Dim iptc As New Aurigma.GraphicsMill.Codecs.IptcDictionary
iptc.Item(Aurigma.GraphicsMill.Codecs.IptcDictionary.Keyword) = "mountain"
iptc.Item(Aurigma.GraphicsMill.Codecs.IptcDictionary.City) = "Olympia"
encoderOptions.Iptc = iptc

bitmap.Save("C:\result.jpg", encoderOptions)

bitmap.Dispose()
```
 
```csharp
using (Aurigma.GraphicsMill.Bitmap bitmap =
           new Aurigma.GraphicsMill.Bitmap(@"C:\mountain.jpg"))
{
    Aurigma.GraphicsMill.Codecs.JpegEncoderOptions encoderOptions =
        new Aurigma.GraphicsMill.Codecs.JpegEncoderOptions(70, false);

    Aurigma.GraphicsMill.Codecs.IptcDictionary iptc =
        new Aurigma.GraphicsMill.Codecs.IptcDictionary();
    iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Keyword] = "mountain";
    iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.City] = "Olympia";
    encoderOptions.Iptc = iptc;

    Aurigma.GraphicsMill.Codecs.ExifDictionary exif =
        new Aurigma.GraphicsMill.Codecs.ExifDictionary();
    exif[Aurigma.GraphicsMill.Codecs.ExifDictionary.Software] = "Aurigma Graphics Mill";
    encoderOptions.Exif = exif;

    bitmap.Save(@"C:\result.jpg", encoderOptions);
}
```
 
Currently, Graphics Mill for .NET can save files of two image format that support EXIF and IPTC information: [JPEG](https://www.graphicsmill.com/docs/gm5/JPEGFileFormat.htm.md) and [TIFF](https://www.graphicsmill.com/docs/gm5/TIFFFileFormat.htm.md).
