This class enables you to read PSD images.
Namespace:
Aurigma.GraphicsMill.Codecs
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
Public NotInheritable Class PsdReader _ Inherits FormatReader _ Implements IMetadataReadSupport
public sealed class PsdReader : FormatReader, IMetadataReadSupport
PSD is the native bitmap file format of the Adobe® Photoshop® graphics editor. This format is standard de facto for designers all over the world. This format is rather complex and stores a lot of data (image layers, text, effects, etc). It is rather complex task to parse it and merge all the layers as they are displayed in the Photoshop. The good news is that PSD file always stores image where all the layers are merged in correct way. Graphics Mill for .NET can load this merged layer, so you can work with PSD files as well as with other image formats.
The code sample below extracts EXIF and IPTC metadata from the PSD file and displays it. It also demonstrates the usage of the PsdReader class.
Dim bitmap As New Aurigma.GraphicsMill.Bitmap Dim reader As New Aurigma.GraphicsMill.Codecs.PsdReader("c:\Mountain.psd") 'Read metadata Dim exif As Aurigma.GraphicsMill.Codecs.ExifDictionary = reader.Exif Dim iptc As Aurigma.GraphicsMill.Codecs.IptcDictionary = reader.Iptc 'Read bitmap Dim frame As Aurigma.GraphicsMill.Codecs.Frame = reader.LoadFrame(0) frame.GetBitmap(bitmap) frame.Dispose() reader.Dispose() 'Show EXIF tags If Not exif Is Nothing Then Console.WriteLine("EXIF") Console.WriteLine("---------------") For Each key As Long In exif.Keys Console.WriteLine("{0}: {1}", exif.GetKeyDescription(key), exif.GetItemString(key)) Next End If 'Show IPTC tags If Not iptc Is Nothing Then Console.WriteLine("IPTC") Console.WriteLine("---------------") For Each key As Long In iptc.Keys Console.WriteLine("{0}: {1}", iptc.GetKeyDescription(key), iptc.GetItemString(key)) Next End If
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(); Aurigma.GraphicsMill.Codecs.PsdReader reader = new Aurigma.GraphicsMill.Codecs.PsdReader(@"c:\Mountain.psd"); //Read metadata Aurigma.GraphicsMill.Codecs.ExifDictionary exif = reader.Exif; Aurigma.GraphicsMill.Codecs.IptcDictionary iptc = reader.Iptc; //Read bitmap Aurigma.GraphicsMill.Codecs.IFrame frame = reader.LoadFrame(0); frame.GetBitmap(bitmap); frame.Dispose(); reader.Dispose(); //Show EXIF tags if (exif != null) { Console.WriteLine("EXIF"); Console.WriteLine("---------------"); foreach (long key in exif.Keys) { Console.WriteLine("{0}: {1}", exif.GetKeyDescription(key), exif.GetItemString(key)); } } //Show IPTC tags if (iptc != null) { Console.WriteLine("IPTC"); Console.WriteLine("---------------"); foreach (long key in iptc.Keys) { Console.WriteLine("{0}: {1}", iptc.GetKeyDescription(key), iptc.GetItemString(key)); } }