This class represents a dictionary of Adobe® image resource blocks, each block is represented by the AdobeResourceBlock class.
Namespace:
Aurigma.GraphicsMill.Codecs
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
Public Class AdobeResourceDictionary _ Inherits MetadataDictionary
public class AdobeResourceDictionary : MetadataDictionary
Adobe® applications (first of all Adobe® Photoshop®) store meta-information in so called Adobe® image resource blocks. Graphics Mill for .NET provides AdobeResourceDictionary class to facilitate work with these data.
All functionality of this class is implemented in base class MetadataDictionary. To put or get some Adobe® image resource block, you should use the Item[Object] property. Just pass ID of the Adobe® image resource block as an argument into this property. Refer Adobe® Photoshop® File Formats Specification for exact Adobe® image resource block ID values.
Instances of AdobeResourceDictionary class are used in two interfaces:
The code sample below demonstrates how to remove thumbnail from Adobe® image resource blocks and mark the image as copyrighted. Thumbnail block ID is 0x0409 and copyright flag ID is 0x040A.
Dim srcFileName As String = "c:/mountain.jpg" Dim dstFileName As String = "c:/mountain2.jpg" ' Open reader on the file you need to modify metadata for Dim reader As New Aurigma.GraphicsMill.Codecs.JpegReader(srcFileName) Dim adobeResources As Aurigma.GraphicsMill.Codecs.AdobeResourceDictionary = reader.AdobeResources If adobeResources Is Nothing Then adobeResources = New Aurigma.GraphicsMill.Codecs.AdobeResourceDictionary End If ' Create new adobe image resource block with the required metadata Dim arBlock As New Aurigma.GraphicsMill.Codecs.AdobeResourceBlock("Copyright", New Byte() {1}) ' Set this block to the item with 0x040A ID (copyright flag) adobeResources.Item(&H40A) = arBlock ' Remove a block with 0x0409 (thumbnail data) adobeResources.Remove(&H409) ' Write new bitmap and metadata Dim writer As New Aurigma.GraphicsMill.Codecs.JpegWriter() writer.Open(dstFileName) writer.AdobeResources = adobeResources writer.AddFrame(reader.LoadFrame(0)) writer.Close() reader.Close()
string srcFileName = @"c:/mountain.jpg"; string dstFileName = @"c:/mountain2.jpg"; using (Aurigma.GraphicsMill.Codecs.JpegReader reader = new Aurigma.GraphicsMill.Codecs.JpegReader()) { // Open reader on the file you need to modify metadata for reader.Open(srcFileName); Aurigma.GraphicsMill.Codecs.AdobeResourceDictionary adobeResources = reader.AdobeResources; if (adobeResources == null) { adobeResources = new Aurigma.GraphicsMill.Codecs.AdobeResourceDictionary(); } // Create new adobe image resource block with the required metadata Aurigma.GraphicsMill.Codecs.AdobeResourceBlock arBlock = new Aurigma.GraphicsMill.Codecs.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 bitmap and metadata using (Aurigma.GraphicsMill.Codecs.JpegWriter writer = new Aurigma.GraphicsMill.Codecs.JpegWriter()) { writer.Open(dstFileName); writer.AdobeResources = adobeResources; writer.AddFrame(reader.LoadFrame(0)); } }