---
Product: psd
Platform: net
Page Type: index
Canonical URL: https://blog.aspose.org/psd/net/psd-core-api-net/
Published: 2026-10-09
Author: Aspose
---

# Aspose.PSD FOSS for .NET: Exploring the Core API

A closer look at the core API surface of Aspose.PSD FOSS for .NET: the Image/PsdImage class hierarchy, the geometry value types used throughout (Point, Rectangle, RectangleF, Size), resource blocks, and the exception types raised on load/save errors.

## Introduction

Aspose.PSD FOSS for .NET loads, inspects, and saves PSD and PSB documents through a small set of classes. This post looks at parts of the core API that the introductory post didn't cover in depth: the `Image`/`PsdImage` inheritance relationship, the geometry value types used throughout the library, and how the library reports load and save errors.

---

## What's Included

### Image and PsdImage

`Image` is the abstract base class and exposes `Width`, `Height`, `Bounds`, `Load()`, `Save()`, and `Dispose()`. `PsdImage` is the sealed, concrete implementation returned by `Image.Load()` for PSD/PSB input — casting the result to `PsdImage` exposes the rest of the document surface: `ColorMode`, `Version`, `Layers`, `Compression`, `BitsPerChannel`, and more.

```csharp
using var image = (PsdImage)Image.Load(inputPath);
Console.WriteLine($"Bounds: {image.Bounds}");       // from the Image base class
Console.WriteLine($"ColorMode: {image.ColorMode}");  // PsdImage-specific
```

### Geometry Value Types

`Point`, `Size`, `Rectangle`, and `RectangleF` are the value types used for bounds and coordinates across the API — `Layer.Bounds` and `Image.Bounds` are both `Rectangle`, and `PsdImage.Size` is a `Size`. `Rectangle` carries real geometry methods: `Contains()`, `Intersect()`, `Union()`, `Inflate()`, and `FromLeftTopRightBottom()`, among others.

```csharp
Rectangle layerBounds = image.Layers[0].Bounds;
Rectangle imageBounds = image.Bounds;

bool fullyInside = imageBounds.Contains(layerBounds);
Rectangle overlap = Rectangle.Intersect(imageBounds, layerBounds);
Console.WriteLine($"Layer fits inside image: {fullyInside}, overlap: {overlap}");
```

### Resource Blocks and Exceptions

`PsdImage.ImageResources` returns the parsed `ResourceBlock[]` array — each block exposes `ID`, `DataSize`, `Name`, and `Signature`. In this FOSS build, `ImageResources`, `GlobalLayerResources`, `ActiveLayer`, and `HasTransparencyData` can be read but not reassigned — each has a setter that throws `NotSupportedException` if called, so treat them as read-only even though they appear as properties.

Load and save errors surface as two dedicated exception types: `PsdLoadException` when a document can't be parsed, and `PsdSaveException` when a document can't be written back out.

```csharp
try
{
    using var image = (PsdImage)Image.Load(inputPath);
    foreach (ResourceBlock resource in image.ImageResources)
    {
        Console.WriteLine($"Resource {resource.ID}: {resource.Name} ({resource.DataSize} bytes)");
    }
}
catch (PsdLoadException ex)
{
    Console.WriteLine($"Failed to load {inputPath}: {ex.Message}");
}
```

---

## Quick Start

```bash
dotnet add package Aspose.PSD.FOSS
```

```csharp
using Aspose.PSD.FileFormats.Psd;

try
{
    using var image = (PsdImage)Image.Load("input.psd");
    Console.WriteLine($"Bounds: {image.Bounds}, ColorMode: {image.ColorMode}");
    Console.WriteLine($"ImageResources: {image.ImageResources.Length}");
}
catch (PsdLoadException ex)
{
    Console.WriteLine($"Load failed: {ex.Message}");
}
```

---

## Supported Formats

| Format | Extension | Read | Write |
|---|---|---|---|
| Photoshop Document | psd | ✓ | ✓ |
| Photoshop Large Document | psb | ✓ | ✓ |

---

## Open Source & Licensing

Aspose.PSD FOSS for .NET is MIT licensed and may be used in commercial products without royalties, with no evaluation watermark or usage limit.

The package is at version 1.0.0 and requires only .NET 10.0 at runtime — it has no other third-party dependencies.

---

## Getting Started

- [Getting Started](https://docs.aspose.org/psd/net/getting-started/)
- [Developer Guide](https://docs.aspose.org/psd/net/developer-guide/)
- [KB Articles](https://kb.aspose.org/psd/net/)
- [API Reference](https://reference.aspose.org/psd/net/)

## Related Resources

- [Aspose.PSD Enterprise Product Family](https://products.aspose.com/psd/)
- [Aspose.PSD — Enterprise Blog](https://blog.aspose.com/)