Working with metadata in GIF images

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Metadata MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-metadata -- dnx GroupDocs.Metadata.Mcp --yes
Folders, licensing and more →

Detecting the GIF version

The following sample of code will help you to detect the version of a loaded GIF image and extract some additional file format information.

  1. Load a GIF image
  2. Extract the root metadata package
  3. Use the FileType property to obtain file format information

AdvancedUsage.ManagingMetadataForSpecificFormats.Image.Gif.GifReadFileFormatProperties

using (Metadata metadata = new Metadata(Constants.InputGif))
{
	var root = metadata.GetRootPackage<GifRootPackage>();

	Console.WriteLine(root.FileType.FileFormat);
	Console.WriteLine(root.FileType.Version);
	Console.WriteLine(root.FileType.ByteOrder);
	Console.WriteLine(root.FileType.MimeType);
	Console.WriteLine(root.FileType.Extension);
	Console.WriteLine(root.FileType.Width);
	Console.WriteLine(root.FileType.Height);
}

Working with XMP Metadata

GroupDocs.Metadata for .NET also allows managing XMP metadata in GIF files. For more details please refer to the following guide: Working with XMP metadata.

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

GIF metadata management demo App

The GIF Metadata Editing app is available to view and edit metadata of GIF images, including XMP properties and image details.