---
Product: psd
Platform: java
Page Type: docs
Canonical URL: https://docs.aspose.org/psd/java/developer-guide/resources
---

# Resources

Image resource blocks in Aspose.PSD FOSS for Java: read them from a PsdImage and what the resource classes represent.

## Overview

A PSD file stores image resources in its Image Resources section. `PsdImage.getImageResources()` returns them as an array of `ResourceBlock`. On the test files of the library this gives 26 blocks for `basic-rgb.psd` and 28 for `resources.psd`. Treat the blocks as read-only data: `PsdImage.setImageResources` always throws `UnsupportedOperationException`, and `getImageResources()` returns a new array of new block objects on every call, so changing one block does not change the image.

---

### ResourceBlock

`ResourceBlock` represents one image resource block. It has `getId()`, `getName()`, `getSignature()`, `getSize()` and `getDataSize()`, and declares `save(OutputStream)`. The blocks that `getImageResources()` returns are `PreservedResourceBlock` objects, and their `save(OutputStream)` always throws `UnsupportedOperationException`. `PreservedResourceBlock` adapts a raw-preserved resource to the `ResourceBlock` surface.

---

### The Resource Classes

| Class | Role |
|---|---|
| `ResourceBlock` | The public base type of an image resource block |
| `PreservedResourceBlock` | Adapts a raw-preserved resource to the `ResourceBlock` surface |
| `UnknownResource` | A parsed resource block without any ID-specific meaning; keeps its id, name and raw data |
| `PsdResourceInfo` | A read-only summary of one parsed resource: id, name, kind and data length |
| `PsdResourceKind` | Classifies a resource: Unknown, GlobalAngle, IccProfile or IccUntaggedProfile |
| `IndexedColorPalette`, `IndexedColorPaletteInfo` | The palette of an indexed-color document, as colors |
| `ImageResourceIds` | Common resource identifiers |

Most of these classes are building blocks that the loader and writer use. Your code normally works with the `ResourceBlock` array that `PsdImage.getImageResources()` returns.

---

### Tips and Best Practices

- Treat the resource array as read-only.
- Use `getId()` to find the block you want; ids are the identifiers that the PSD format defines.

---

### Common Issues

| Issue | Cause | Fix |
|---|---|---|
| `UnsupportedOperationException` from `setImageResources` | Replacing resources is not supported in this edition | Do not replace resources; edit layer metadata instead |
| Setting an id on a block has no effect on the image | `getImageResources()` returns new block objects each time | Treat blocks as read-only |

---

### FAQ

#### Can I add or remove an image resource?

Not through the public API of this edition.

---

### API Reference Summary

| Class | Description |
|---|---|
| [ResourceBlock](https://reference.aspose.org/psd/java/resourceblock/) | An image resource block |
| [PreservedResourceBlock](https://reference.aspose.org/psd/java/preservedresourceblock/) | A raw-preserved resource block |
| [UnknownResource](https://reference.aspose.org/psd/java/unknownresource/) | A resource block without specific meaning |
| [PsdResourceKind](https://reference.aspose.org/psd/java/psdresourcekind/) | The resource classification |
| [IndexedColorPalette](https://reference.aspose.org/psd/java/indexedcolorpalette/) | An indexed-color palette |

## See Also

- [Aspose.PSD — Enterprise Documentation](https://docs.aspose.com/psd/)