---
title: "Read Image Metadata"
canonical: https://www.graphicsmill.com/samples/Codecs/LoadingAndSavingImages/ReadImageMetadata_cs
product: "Graphics Mill"
source: "Codecs/LoadingAndSavingImages/ReadImageMetadata.cs"
---

# Read Image Metadata

Reads image metadata without loading bitmap data.

## Instruction

Write a C# program that reads metadata (EXIF, IPTC) from an image file without loading the bitmap data.

## Usings

```csharp
using System;
using Aurigma.GraphicsMill.Codecs;
```

## Code Snippet

```csharp
using (var reader = ImageReader.Create("Chicago.jpg"))
{
    Console.WriteLine("Width: {0}", reader.Width);
    Console.WriteLine("Height: {0}", reader.Height);
    Console.WriteLine("Pixel format: {0}", reader.PixelFormat);

    if (reader.Exif != null)
    {
        Console.WriteLine("EXIF tag count: {0}", reader.Exif.Count);
    }

    if (reader.Iptc != null)
    {
        Console.WriteLine("IPTC tag count: {0}", reader.Iptc.Count);
    }
}
```

## Explanation

Below is a C# code sample that demonstrates how to read the metadata (EXIF, IPTC) from an image file without loading the bitmap data:

This example efficiently accesses image metadata properties such as width, height, and pixel format, as well as EXIF and IPTC tags, without actually loading the image data into memory.

## Tags

- [Filesystem](<https://www.graphicsmill.com/samples/tags/filesystem_md>): Loading and saving images from files
- [JPG](<https://www.graphicsmill.com/samples/tags/jpg_md>): Reading and writing JPEG images
- [Metadata](<https://www.graphicsmill.com/samples/tags/metadata_md>): Reading and writing image metadata
- [Read](<https://www.graphicsmill.com/samples/tags/read_md>): Reading images with codecs

## Input

- [Chicago.jpg](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/Chicago_jpg>) (preview)

## Output

- [ReadImageMetadata.txt](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/ReadImageMetadata_txt>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Codecs.ImageReader](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_ImageReader.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageReader.Create(String)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_ImageReader_Create_1_bb3a7a4f.htm.md>)
- [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.ImageReader.PixelFormat](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_ImageReader_PixelFormat.htm.md>)
- [Aurigma.GraphicsMill.Codecs.MetadataDictionary.Count](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_MetadataDictionary_Count.htm.md>)
