A Rust library for reading and writing Adobe Photoshop PSD and PSB files.
psd-great aims to be the most feature-rich and complete PSD/PSB reading and writing crate in Rust. It began as a port of the TypeScript ag-psd parser/writer and has since grown into a broader typed Rust API for document structure, layers, tagged blocks, resources, text, effects, masks, paths, and smart-object metadata.
This crate is not currently published on crates.io.
Use it as a Git dependency:
[dependencies]
psd-great = { git = "git@github.com:ioma8/psd-great.git" }use psd_great::*;
use std::fs::File;
fn main() -> Result<()> {
let file = File::open("input.psd")?;
let mut psd = read_psd(file, ReadOptions::default())?;
println!("{}x{}", psd.width, psd.height);
if let Some(ref mut layers) = psd.children {
for layer in layers {
layer.opacity = Some(128.0);
}
}
let bytes = write_psd(&psd, &WriteOptions::default())?;
std::fs::write("output.psd", bytes)?;
Ok(())
}- PSD and PSB read/write
- Typed public API centered on
Psd,Layer,ReadOptions, andWriteOptions - Layer trees, groups, masks, blend modes, layer effects, and many tagged blocks
- Text structures, engine data, style runs, paragraph runs, and document resources
- Paths, slices, thumbnails, XMP, linked files, placed layers, and smart-object metadata
- ABR, ASE, and CSH parsing helpers
| Area | Status | Notes |
|---|---|---|
| PSD/PSB structure | Broad support | Reader and writer cover the main parser/writer surface |
| Layers, masks, effects | Broad support | Includes vector masks, many tagged blocks, and effect structures |
| Text layers | Partial | Rich text structures are supported, but not every Photoshop text workflow is exhaustively validated |
| Color modes | Partial | Indexed palettes and generic color-mode data are supported; some composite-image behavior still varies by mode |
| 16/32-bit depth | Partial | Structural support exists, but not every path is fully validated end to end |
| Smart objects / linked data | Partial | Typed structures exist, but not every Photoshop workflow is exhaustively covered |
- This crate is a PSD/PSB parser and writer, not a Photoshop compositor or rasterizer.
- Editing text, vector data, masks, or effects does not automatically redraw layer pixels or the composite image.
- Some non-RGB modes such as
Multichannel,Duotone, andLabare preserved structurally, but composite-image decoding and write-side color handling are still incomplete in some paths. - Higher bit depths are only partially supported.
- Newer Photoshop features, animation/timeline workflows, smart filters, and 3D-related data have significant typed coverage, but not every workflow has exhaustive interoperability validation.
cargo run --example read_psd path/to/file.psd
cargo run --example modify_psd path/to/input.psd output.psd
cargo run --example extract_layers path/to/file.psd
cargo run --example create_psdapi- public document model typesformat- PSD/PSB wire-format sectionsio- high-level readers and writerssupport- internal helpersformats- ABR, ASE, and CSH support
Generate API docs locally with:
cargo doc --open