Represents the Adobe® image resource block.
Namespace:
Aurigma.GraphicsMill.Codecs
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
public sealed class AdobeResourceBlock : IDisposable
Image resource blocks are one of the basic building units of several file formats, including Photoshop native file format, JPEG, and TIFF. Image resources are used to store non-pixel data associated with an image, such as pen tool paths.
Graphics Mill does not perform any validation of the resource data internal structure while encoding. So, you should provide correctly generated AdobeResourceBlock instances. Files containing incorrect Adobe® image resource blocks can produce errors during opening or processing in Adobe® applications.
The following code removes the thumbnail from Adobe image resource blocks and marks the image as copyrighted. Thumbnail block ID is 0x0409 and copyright flag ID is 0x040A.
using (var reader = new JpegReader(@"Images\in.jpg")) { // Open reader on the file you need to modify metadata for 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); // Write new image and metadata using (var writer = new JpegWriter(@"Images\out.jpg")) { writer.AdobeResources = adobeResources; Pipeline.Run(reader + writer); } }