pub struct PSDDecoder<T>where
    T: ZReaderTrait,{ /* private fields */ }
Expand description

A simple Photoshop PSD reader.

This currently doesn’t support layer flattening but it’s useful enough in that we can extract images from it.

Further work will go onto adding a renderer that flattens image pixels. But for now this is a good basis.

Implementations§

source§

impl<T> PSDDecoder<T>where T: ZReaderTrait,

source

pub fn new(data: T) -> PSDDecoder<T>

Create a new decoder that reads a photoshop encoded file from T and returns pixels

Arguments
  • data: Data source, it has to implement the `ZReaderTrait
source

pub fn new_with_options(data: T, options: DecoderOptions) -> PSDDecoder<T>

Creates a new decoder with options that influence decoding routines

Arguments
  • data: Data source
  • options: Custom options for the decoder
source

pub fn decode_headers(&mut self) -> Result<(), PSDDecodeErrors>

Decode headers from the encoded image

This confirms whether the image is a photoshop image and extracts relevant information from the image including width,height and extra information.

source

pub fn decode_raw(&mut self) -> Result<Vec<u8>, PSDDecodeErrors>

Decode an image to bytes without regard to depth or endianness

Returns

Ok(bytes): Raw bytes of the image Err(E): An error if it occurred during decoding

source

pub fn decode(&mut self) -> Result<DecodingResult, PSDDecodeErrors>

Decode a PSD file extracting the image only

Currently this does it without respect to layers and such, only extracting the PSD image, hence might not be the most useful one.

source

pub const fn get_bit_depth(&self) -> Option<BitDepth>

Get image bit depth or None if the headers haven’t been decoded

source

pub fn get_dimensions(&self) -> Option<(usize, usize)>

Get image width and height respectively or None if the headers haven’t been decoded

source

pub fn get_colorspace(&self) -> Option<ColorSpace>

Get image colorspace or None if the image header hasn’t been decoded

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for PSDDecoder<T>where T: RefUnwindSafe,

§

impl<T> Send for PSDDecoder<T>where T: Send,

§

impl<T> Sync for PSDDecoder<T>where T: Sync,

§

impl<T> Unpin for PSDDecoder<T>where T: Unpin,

§

impl<T> UnwindSafe for PSDDecoder<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.