Struct psd::Psd

source · []
pub struct Psd { /* private fields */ }
Expand description

Represents the contents of a PSD file

PSB Support

We do not currently support PSB since the original authors didn’t need it, but adding support should be trivial. If you’d like to support PSB please open an issue.

Implementations

Create a Psd from a byte slice.

You’ll typically get these bytes from a PSD file.

Example
let psd_bytes = include_bytes!("./my-psd-file.psd");

let psd = Psd::from_bytes(psd_bytes);

The width of the PSD file

The height of the PSD file

The number of bits per channel

The color mode of the file

Get all of the layers in the PSD

Get a layer by name

Get a layer by index.

index 0 is the bottom layer, index 1 is the layer above that, etc

Get all of the groups in the PSD, in the order that they appear in the PSD file.

Get the group ID’s in the order that they appear in Photoshop. (i.e. from the bottom of layers view to the top of the layers view).

Returns sub layers of group by group id

Given a filter, combine all layers in the PSD that pass the filter into a vector of RGBA pixels.

We’ll start from the top most layer and iterate through the pixels.

If the pixel is transparent, recursively blend it with the pixels below it until we hit an opaque pixel or we hit the bottom of the stack.

TODO: Take the layer’s blend mode into account when blending layers. Right now we just use ONE_MINUS_SRC_ALPHA blending regardless of the layer.

Get the RGBA pixels for the PSD [ R,G,B,A, R,G,B,A, R,G,B,A, …]

Get the compression level for the flattened image data

Resources from the image resources section of the PSD file

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.