This documentation is for the old version. Go to the latest Graphics Mill docs

PSD File Format

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.

If you need to extract individual frames (raster or text), you should use Advanced PSD Add-on for Graphics Mill. You can read about its features more detailed in the Introduction to Advanced PSD Add-on.

Format Name

PSD

MIME Type

application/x-photoshop

File Extensions

*.psd

Supported Pixel Formats

Description Read Write
8 bit grayscale Yes No
16 bit grayscale with the alpha channel Yes No
16 bit grayscale (16 bits per channel) Yes No
24 bit RGB Yes No
32 bit RGB with the alpha channel Yes No
48 bit RGB (16 bits per channel) Yes No
64 bit RGB with the alpha channel (16 bits per channel) Yes No
32 bit CMYK Yes No
40 bit CMYK with the alpha channel Yes No
64 bit CMYK (16 bits per channel) Yes No
80 bit CMYK with the alpha channel (16 bits per channel) Yes No

Metadata Available for Reading

Name Comments
PsdReader.Exif EXIF data collection.
PsdReader.Iptc IPTC data collection.

Examples

Loading PSD Files

The simplest way to load the PSD file is to pass its name to the constructor:

Visual Basic
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\Mountain.psd")
C#
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"c:\Mountain.psd");

Alternatively, if you already have an instance of the Bitmap, you can use Load method:

Visual Basic
Dim bitmap As New Aurigma.GraphicsMill.Bitmap
bitmap.Load("c:\Mountain.psd")
C#
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap();
bitmap.Load(@"c:\Mountain.psd");

Reading EXIF and IPTC Metadata From the PSD File

The code example below extracts EXIF and IPTC metadata from the PSD file and displays it. It also demonstrates the usage of the PsdReader class.

Visual Basic
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
C#
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));
    }
}

Working with Layers

To work with separate layers, it is necessary to use Advanced PSD Add-on. You can find code examples for this add-on in the Advanced PSD Add-on documentation. In particular, it is recommended to check the following topics:

Loading Raster Layers
Loading Text Layers
Merging Layers