veyh/psd-preview

Read image previews from PSD files

★ 0Forks 0RustGitHub ↗Compare

README

psd-preview

psd-preview is a Rust library for reading image previews from PSD files. It reads both the small JPEG thumbnails and the bigger composite images that are included when saving with the "maximize compatibility" option.

Usage

Read from disk

let preview = PsdPreview::from_path("foo.psd").unwrap();

Read from eg. a Vec<u8>

let v: Vec<u8> = vec![/* pretend there's some raw image data here */];
let c = std::io::Cursor::new(v);
let preview = PsdPreview::from_reader(c).unwrap();

And use the result

if let Some(rgb) = preview.composite {
    println!(
        "composite image: {}x{}, {} bytes", 
        rgb.width, rgb.height, rgb.data.len()
    );
}

println!("jpeg thumbnail: {} bytes", preview.thumb_jpeg.len());

Contributors

veyh

Issues