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

AdvancedPsdReader Class

This class is used to read PSD files layer by layer.

Namespace: Aurigma.GraphicsMill.Codecs
Assembly: Aurigma.GraphicsMill.Codecs.AdvancedPsd (in Aurigma.GraphicsMill.Codecs.AdvancedPsd.dll)

Syntax

Visual Basic
Public NotInheritable Class AdvancedPsdReader _
	Inherits FormatReader _
	Implements IMetadataReadSupport
C#
public sealed class AdvancedPsdReader : FormatReader, IMetadataReadSupport

Remarks

PSD file format is popular for creating graphics design templates for web sites as well as for printing production. The great feature of PSD format is that it allows to keep image separated by so-called layers. It enables designers to easily modify only one piece of image without having to change the entire image. Also, the layer can be easily hidden/shown with a single click.

Advanced PSD add-on supports two kinds of layers: raster and text ones. Raster layers contain an image (bitmap). Text layers contain a text string as well as font and paragraph settings as well as a number of other information which helps to render the text string. Also, text layers always contain rasterized text string (i.e. they can be interpreted as a particular case of raster layers). In fact PSD files can store other kinds of layers (such as vector masks, adjustment layers, etc), however Advanced PSD add-on does not support them and they are treated as unknown.

This way PSD files are convenient to use as templates for personalized graphics. The idea is very simple: the designer creates a template and when it is necessary to print or generate the personalized image, the software replaces some layers which contain the personal information by the custom data. For example, if you are building an application which prepares business cards, you can let users to change the company logo, first and last name of the person, their position, phone number, etc.

AdvancedPsdReader has the same structure as any other reader object in Graphics Mill. To get layers (in terms of Graphics Mill, frames) you should use the foreach statement or the LoadFrame(Int32) method. This way you will get instances of the AdvancedPsdFrame object. To extract the bitmap from that object, use the GetBitmap(Bitmap) method.

If the layer is text, you can extract the text information from it. To do it, you need to make sure that the frame has a text type, check out the value of the Type property. If it equals to Text, you can cast this frame to AdvancedPsdTextFrame which exposes all necessary text settings.

Note

When you use Advanced PSD add-on you should remember that it supports only limited subset of PSD files. A lot of PSD features are not supported. That's why you should not expect that you can process arbitrary PSD file 100% correctly. You need to prepare PSD templates keeping in mind limitations of the Advanced PSD add-on.

Another caveat concerns the text rendering. If you render the text string yourself using the Graphics Mill drawing means, you may find out that the result is slightly different than in Photoshop. The problem is that Graphics Mill uses standard Microsoft font rasterizer. At the same time, Adobe has their own font rasterizer which is used in all their products. Therefore you will never get per-pixel accuracy. In particular, the width of the string rendered by Photoshop and Graphics Mill may vary on few pixels. Nonetheless in most tasks it does not make problems.

Inheritance Hierarchy

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

Object Model







See Also

Reference