---
title: "Write Adobe Image Resource Block"
canonical: https://www.graphicsmill.com/samples/Metadata/AdobeImageResourceBlocks/WriteAdobeResourceBlock_cs
product: "Graphics Mill"
source: "Metadata/AdobeImageResourceBlocks/WriteAdobeResourceBlock.cs"
---

# Write Adobe Image Resource Block

Write copyright XMP block.

## Instruction

Write a copyright XMP block to an image file using AdobeResourceBlock and save the result.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
```

## Code Snippet

```csharp
public static void Run()
{
    Write("Chicago.jpg", "Chicago_AdobeResourceBlock.jpg");
    Write("Venice.jpg", "Venice_AdobeResourceBlock.jpg");
}

private static void Write(string inputPath, string outputPath)
{
    using (var reader = new JpegReader(inputPath))
    using (var writer = new JpegWriter(outputPath))
    {
        var adobeResources = reader.AdobeResources;
        if (adobeResources == null)
        {
            adobeResources = new AdobeResourceDictionary();
        }

        // Create new adobe image resource block with the required metadata
        var arBlock = new AdobeResourceBlock("Copyright", new byte[] { 1 });

        // Set this block to the item with 0x040A ID (copyright flag)
        adobeResources[0x040A] = arBlock;

        // Remove a block with 0x0409 (thumbnail data)
        adobeResources.Remove(0x0409);

        writer.AdobeResources = adobeResources;
        Pipeline.Run(reader + writer);
    }
}
```

## Explanation

The code:

- Reads the JPEG image from the specified input path.
- Retrieves and modifies the Adobe resource block by adding a new copyright block (0x040A) with specific metadata.
- Removes the thumbnail data block (0x0409).
- Writes the modified Adobe resources back to the output image file.

## Tags

- [Adobe Resources](<https://www.graphicsmill.com/samples/tags/adobe-resources_md>): Working with Adobe image resource blocks

## Input

- [Chicago.jpg](<https://www.graphicsmill.com/samples/Metadata/compiled/Debug/Chicago_jpg>) (preview)
- [Venice.jpg](<https://www.graphicsmill.com/samples/Metadata/compiled/Debug/Venice_jpg>) (preview)

## Output

- [Chicago\_AdobeResourceBlock.jpg](<https://www.graphicsmill.com/samples/Metadata/compiled/Debug/Chicago_AdobeResourceBlock_jpg>) (preview)
- [Venice\_AdobeResourceBlock.jpg](<https://www.graphicsmill.com/samples/Metadata/compiled/Debug/Venice_AdobeResourceBlock_jpg>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Codecs.AdobeResourceBlock](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_AdobeResourceBlock.htm.md>)
- [Aurigma.GraphicsMill.Codecs.AdobeResourceDictionary](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_AdobeResourceDictionary.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageReader.AdobeResources](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_ImageReader_AdobeResources.htm.md>)
- [Aurigma.GraphicsMill.Codecs.JpegReader](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_JpegReader.htm.md>)
- [Aurigma.GraphicsMill.Codecs.JpegWriter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_JpegWriter.htm.md>)
- [Aurigma.GraphicsMill.Codecs.JpegWriter.AdobeResources](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_JpegWriter_AdobeResources.htm.md>)
- [Aurigma.GraphicsMill.Codecs.MetadataDictionary.Remove(Object)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_MetadataDictionary_Remove_1_d02429b3.htm.md>)
