---
title: "Loading Text Layers"
canonical: https://www.graphicsmill.com/docs/gm/loading-text-layers.htm
product: "Graphics Mill"
---

# Loading Text Layers
 
Graphics Mill supports loading [layers of different types](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_Psd_FrameType.htm.md) from PSD files. Text layers store a text string and its appearance settings (font, color, paragraph, etc.) along with a bitmap. You can create personalized graphics by using text layers as placeholders in a PSD template. Just change text in a placeholder and merge PSD file layers. This article describes how to work with text layers, including transformed text and text on a curve.
 
## Common Text Settings
  
To start reading a PSD file use the [PsdReader(String)](https://www.graphicsmill.com/docs/gm/O_T_Aurigma_GraphicsMill_Codecs_Psd_PsdReader_ctor.htm.md) constructor, which accepts a filename as an argument.
 
**Note** 
While a PSD file is opened by Graphics Mill, no other application can delete or modify the file.
 
To access layers use the [PsdReader.Frames](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdReader_Frames.htm.md) property which returns a collection of [PsdFrame](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_Psd_PsdFrame.htm.md) instances. A text layer is represented by the [PsdTextFrame](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame.htm.md) class which extends the **PsdFrame** class with a text-specific functionality. For each text layer the following data can be obtained:
 
- text color ([Color](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_Color.htm.md)),
- text font name and size (the [FontName](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_FontName.htm.md) and [FontSize](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_FontSize.htm.md) properties),
- text string itself (the [Text](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_Text.htm.md) property),
- text region location and size (the [TextBox](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_TextBox.htm.md) property),
- text caps settings (the [Caps](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_Caps.htm.md) property),
- spacing between characters (the [PsdTextFrame.Tracking](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_Tracking.htm.md) property),
- whether the text is vertical (the [IsVertical](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_IsVertical.htm.md) property),
- paragraph settings (the [Paragraph](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_Paragraph.htm.md) property):
    - left margin indent (the [ParagraphSettings.LeftIndent](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_ParagraphSettings_LeftIndent.htm.md) property),
    - right margin indent (the [ParagraphSettings.RightIndent](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_ParagraphSettings_RightIndent.htm.md) property),
    - first line indent (the [ParagraphSettings.FirstLineIndent](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_ParagraphSettings_FirstLineIndent.htm.md) property),
    - space before the paragraph (the [ParagraphSettings.SpaceBeforeParagraph](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_ParagraphSettings_SpaceBeforeParagraph.htm.md) property),
    - space after the paragraph (the [ParagraphSettings.SpaceAfterParagraph](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_ParagraphSettings_SpaceAfterParagraph.htm.md) property),
    - text alignment (the [PsdTextFrame.Justification](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_Justification.htm.md) property).

The following code reads a PSD file, iterates through its layers, and writes some information about a text layer to the console:
 
```csharp
//create PSD reader
using (var reader = new PsdReader(@"Images\BusinessCard.psd"))
{
    //read layers and check for a text layer
    for (int i = 0; i < reader.Frames.Count; i++)
    {
        using (var frame = reader.Frames[i])
        {
            if (frame.Type == FrameType.Text)
            {
                var textFrame = (PsdTextFrame) frame;
                Console.WriteLine("Font name: " + textFrame.FontName);
                Console.WriteLine("Font size: " + textFrame.FontSize);
                Console.WriteLine("Text caps: " + textFrame.Caps);
                Console.WriteLine("Text justification: " + textFrame.Justification);
                Console.WriteLine("Paragraph first line indent: " + textFrame.Paragraph.FirstLineIndent);
                Console.WriteLine("Text tracking: " + textFrame.Tracking);
                Console.WriteLine("Text box: " + textFrame.TextBox);
                break;
            }
        }
    }
}
```
 
## Text on Curves and Transformed Text Settings
  
For transformed and curved text additionally you can extract
 
- the curve which the text is located along (the [PsdTextFrame.Path](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_Path.htm.md) property),
- layer transformation matrix (the [PsdTextFrame.Transform](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame_Transform.htm.md) property),

The following code reads a PSD file, iterates through its layers, and writes information to the console about a curve which the curved text is located along:
 
```csharp
            //create PSD reader
            using (var reader = new PsdReader(@"Images\Seal.psd"))
            {
                //read layers and check for a text layer
                for (int i = 0; i < reader.Frames.Count; i++)
                {
                    using (var frame = reader.Frames[i])
                    {
                        if (frame.Type == FrameType.Text)
                        {
                            var textFrame = (PsdTextFrame)frame;
                            Console.WriteLine("Text path length in pixels: " + textFrame.Path.GetLength());
                            if (textFrame.Path.Points.Count > 0)
                            {
                                Console.WriteLine("Text path points: ");
                                for (int j = 0; j < textFrame.Path.Points.Count; j++)
                                    Console.WriteLine("point " + j + ": " + textFrame.Path.Points[j].Type + " (" + 
                                        textFrame.Path.Points[j].X + ";" + textFrame.Path.Points[j].Y + ") ");
                            }
                            Console.WriteLine("Text box: " + textFrame.TextBox);
//                            break;
                        }
                    }
                }
            }
```
 
For more information about the paths, see the [Working with Paths](https://www.graphicsmill.com/docs/gm/working-with-path.htm.md) topic.
 
To get a layer transformation matrix you can do as follows:
 
```csharp
            //create PSD reader
            using (var reader = new PsdReader(@"Images\Seal.psd"))
            {
                //read layers and check for a text layer
                for (int i = 0; i < reader.Frames.Count; i++)
                {
                    using (var frame = reader.Frames[i])
                    {
                        if (frame.Type == FrameType.Text)
                        {
                            var textFrame = (PsdTextFrame)frame;
                            Console.WriteLine("Text transformation matrix: ");
                            var matrix = textFrame.Transform.Elements;
                            Console.WriteLine("( " + matrix[0] + " " + matrix[2] + " " + matrix[4] + " )");
                            Console.WriteLine("( " + matrix[1] + " " + matrix[3] + " " + matrix[5] + " )");
//                          break;
                        }
                    }
                }
            }
```
 
For more information about transformation matrices, see the [Affine and Projective Transformations](https://www.graphicsmill.com/docs/gm/affine-and-projective-transformations.htm.md) topic.
 
## See Also
  
### Reference
 
- [PsdReader Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_Psd_PsdReader.htm.md)
- [PsdReader.Frames Property](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdReader_Frames.htm.md)
- [PsdFrame Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_Psd_PsdFrame.htm.md)
- [PsdTextFrame Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_Psd_PsdTextFrame.htm.md)

### Manual
 
- [Working with Photoshop (PSD) Files](https://www.graphicsmill.com/docs/gm/working-with-psd-files.htm.md)
- [Loading Raster Layers](https://www.graphicsmill.com/docs/gm/loading-raster-layers.htm.md)
- [Working with Paths](https://www.graphicsmill.com/docs/gm/working-with-path.htm.md)
- [Affine and Projective Transformations](https://www.graphicsmill.com/docs/gm/affine-and-projective-transformations.htm.md)
