---
title: "Loading Raster Layers"
canonical: https://www.graphicsmill.com/docs/gm/loading-raster-layers.htm
product: "Graphics Mill"
---

# Loading Raster 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. This article describes how to work with raster layers.
 
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. For each raster layer the following data can be obtained:
 
- bitmap (the [GetBitmap()](https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_Psd_PsdFrame_GetBitmap.htm.md) method),
- name (the [Name](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdFrame_Name.htm.md) property),
- dimensions (the [Height](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Frame_Height.htm.md) and the [Width](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Frame_Width.htm.md) properties),
- pixel format (the [PixelFormat](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Frame_PixelFormat.htm.md) property),
- position of the upper-left corner (the [X](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdFrame_X.htm.md) and the [Y](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdFrame_Y.htm.md) properties),
- visibility (the [IsVisible](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdFrame_IsVisible.htm.md) property).

**Note** 
Check the layer type before extracting a bitmap. It is impossible to extract a bitmap from a layer of an unknown type.
 
The following code opens a PSD file, iterates through its layers, and saves bitmaps from the raster layers to separate PNG files:
 
```csharp
//create PSD reader
using (var reader = new PsdReader(@"Images\BusinessCard.psd"))
{
    //read layers and save raster layers in PNG files
    for (int i = 0; i < reader.Frames.Count; i++)
    {
        using (var frame = reader.Frames[i])
        {
            Console.WriteLine("Frame " + frame.Index + " is processing. Frame type is " + frame.Type + ".");

            if (frame.Type == FrameType.Raster)
            {
                using (var bitmap = frame.GetBitmap())
                {
                    bitmap.Save(@"Images\Output\frame_" + i + ".png");
                }
            }
        }
    }
}
```
 
## 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)

### Manual
 
- [Working with Photoshop (PSD) Files](https://www.graphicsmill.com/docs/gm/working-with-psd-files.htm.md)
- [Loading Text Layers](https://www.graphicsmill.com/docs/gm/loading-text-layers.htm.md)
