Working with metadata in PSD 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 →

Reading Photoshop Metadata properties

The GroupDocs Metadata API allows the user to read Adobe Photoshop metadata associated with a PSD image. For more information on the Photoshop file format and metadata blocks please refer to the specification: https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/.

The code sample below demonstrates how to extract image resource blocks (building blocks of the Photoshop file format) from a PSD image.

  1. Load a PSD file
  2. Get the root metadata package
  3. Extract the ImageResourcePackage instance and obtain a list of ImageResourceBlock objects
  4. Iterate trough the collection of resource blocks

advanced_usage.managing_metadata_for_specific_formats.image.psd.PsdReadImageResourceBlocks

try (Metadata metadata = new Metadata(Constants.PsdWithIrb)) {
	PsdRootPackage root = metadata.getRootPackageGeneric();
	if (root.getImageResourcePackage() != null) {
		for (ImageResourceBlock block : root.getImageResourcePackage().toList()) {
			System.out.println(block.getSignature());
			System.out.println(block.getID());
			System.out.println(block.getName());
			System.out.println(block.getData());
		}
	}
}

Reading the image header and information about PSD layers

The GroupDocs.Metadata API also supports extracting some other format-specific information from PSD images.

The following are the steps to read the header of a PSD file and extract information about the PSD layers.

  1. Load a PSD image
  2. Get the root metadata package
  3. Extract  the native metadata package using the PsdRootPackage.getPsdPackage method
  4. Read the PSD header and layer information

advanced_usage.managing_metadata_for_specific_formats.image.psd.PsdReadNativeMetadataProperties

try (Metadata metadata = new Metadata(Constants.PsdWithIptc)) {
	PsdRootPackage root = metadata.getRootPackageGeneric();

	System.out.println(root.getPsdPackage().getChannelCount());
	System.out.println(root.getPsdPackage().getColorMode());
	System.out.println(root.getPsdPackage().getCompression());
	System.out.println(root.getPsdPackage().getPhotoshopVersion());

	for (PsdLayer layer : root.getPsdPackage().getLayers()) {
		System.out.println(layer.getName());
		System.out.println(layer.getBitsPerPixel());
		System.out.println(layer.getChannelCount());
		System.out.println(layer.getFlags());
		System.out.println(layer.getHeight());
		System.out.println(layer.getWidth());

		// ...
	}

	// ...
}

Working with XMP metadata

GroupDocs.Metadata for Java allows managing XMP metadata in JPEG images. For more details please refer to the following guide: Working with XMP Metadata.

Working with EXIF metadata

The GroupDocs.Metadata API supports handling EXIF metadata in JPEG images. Please find appropriate code samples in the Working with EXIF Metadata section.

Working with IPTC metadata

GroupDocs.Metadata for Java is also able to work with IPTC metadata in PSD images. Please find more information in the Working with IPTC IIM Metadata section.

More resources

GitHub examples

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

PSD metadata management demo App

The PSD Metadata Editing app is available to view and edit metadata of Photoshop (PSD) images, including XMP, EXIF, IPTC, and other properties.