---
Product: psd
Platform: java
Page Type: kb
Canonical URL: https://kb.aspose.org/psd/java/how-to-work-with-sections-java
Last Updated: 2026-11-19
---

# How the PSD Section Classes Fit Together in Java

What the section classes of Aspose.PSD FOSS for Java model, and why you normally work through PsdImage instead of reading sections yourself.

A PSD or PSB file has five sections: header, color mode data, image resources, layer and mask information, and image data. The package `org.aspose.psd.sections` has a class for each. This guide explains how to choose between them and `PsdImage`.

## Step-by-Step Guide

### Step 1: Decide Whether You Need Sections

If you want the width, height, bit depth, color mode or compression of a document, call the getters of `PsdImage`. If you want layers, call `PsdImage.getLayers()`. `PsdImage` keeps its parsed sections internal, so these getters are the supported way to read them.

---

### Step 2: Know What Each Class Models

`PsdHeader` models the header, `ColorData` the color mode data, `ImageResourcesSection` the image resources, `LayerAndMaskSection` the layer and mask information and `ImageData` the merged image data. `PsdImageDocumentState` holds the parsed sections of one document.

---

### Step 3: Use the Read-Only Views

`PsdColorDataInfo` and `PsdImageDataInfo` are read-only views of the color data and the image data. `ImageDataKind` says how the image data is laid out and `PsdColorDataKind` says how the color data was interpreted.

## Things to Know

- These classes are low-level building blocks of the loader and writer.
- The sections keep raw bytes, so a document that you save without changes is written back identically in the library's tests.

## See Also

- [Sections in the documentation](https://docs.aspose.org/psd/java/developer-guide/sections/)
- [PsdHeader reference](https://reference.aspose.org/psd/java/psdheader/)
- [Aspose.PSD for Java — Enterprise Knowledge Base](https://kb.aspose.com/psd/java/)