---
title: "Read EXIF and IPTC"
canonical: https://www.graphicsmill.com/samples/Metadata/EXIFAndIPTC/ReadExifIptc_cs
product: "Graphics Mill"
source: "Metadata/EXIFAndIPTC/ReadExifIptc.cs"
---

# Read EXIF and IPTC

Reads EXIF and IPTC metadata.

## Instruction

Read and display EXIF and IPTC metadata from a JPEG image, printing all available tags and their values to the console.

## Usings

```csharp
using System;
using Aurigma.GraphicsMill.Codecs;
```

## Code Snippet

```csharp
using (var jpegReader = new JpegReader("Chicago.jpg"))
{
    // Read metadata
    var exif = jpegReader.Exif;
    var iptc = jpegReader.Iptc;

    // Show EXIF tags
    if (exif != null)
    {
        Console.WriteLine("EXIF");
        Console.WriteLine("---------------");
        foreach (object 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));
        }
    }
}
```

## Explanation

The code:

- Reads the input JPEG image and extracts its EXIF and IPTC metadata.
- Displays the EXIF tags and their descriptions along with the values in the console.
- Displays the IPTC tags and their descriptions along with the values in the console.

## Tags

- [EXIF](<https://www.graphicsmill.com/samples/tags/exif_md>): Managing EXIF metadata
- [IPTC](<https://www.graphicsmill.com/samples/tags/iptc_md>): Managing IPTC metadata
- [Read](<https://www.graphicsmill.com/samples/tags/read_md>): Reading images with codecs

## Input

- [Chicago.jpg](<https://www.graphicsmill.com/samples/Metadata/compiled/Debug/Chicago_jpg>) (preview)

## Output

- [ReadExifIptc.txt](<https://www.graphicsmill.com/samples/Metadata/compiled/Debug/ReadExifIptc_txt>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Codecs.ImageReader.Exif](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_ImageReader_Exif.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageReader.Iptc](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_ImageReader_Iptc.htm.md>)
- [Aurigma.GraphicsMill.Codecs.JpegReader](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_JpegReader.htm.md>)
- [Aurigma.GraphicsMill.Codecs.MetadataDictionary.GetItemString(Object)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_MetadataDictionary_GetItemString_1_d02429b3.htm.md>)
- [Aurigma.GraphicsMill.Codecs.MetadataDictionary.GetKeyDescription(Object)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_MetadataDictionary_GetKeyDescription_1_d02429b3.htm.md>)
- [Aurigma.GraphicsMill.Codecs.MetadataDictionary.Keys](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_MetadataDictionary_Keys.htm.md>)
