Table of Contents

Class PsdResource

Namespace
Egami.Formats.Psd
Assembly
Egami.dll

An image resource Egami does not map to RasterMetadata, kept as it was read.

public sealed record PsdResource : IEquatable<PsdResource>
Inheritance
PsdResource
Implements
Inherited Members

Examples

using Raster image = Raster.Load("photo.psd");
var details = (PsdDetails)image.Metadata.FormatDetails!;
Console.WriteLine($"{(details.Version == 2 ? "PSB" : "PSD")}, {details.ColorMode} at {details.BitsPerChannel} bits, {details.ChannelCount} channels, {details.Compression}");
if (!details.HasRealComposite)
{
    // Saved without Maximize Compatibility: what loaded is Photoshop's placeholder, and a warning says so.
    Console.WriteLine("Save the file again with Maximize Compatibility on.");
}

foreach (PsdResource resource in details.OtherResources)
{
    Console.WriteLine($"Resource {resource.Id}, {resource.Data.Length} bytes");
}

Constructors

PsdResource(int, string, ReadOnlyMemory<byte>)

An image resource Egami does not map to RasterMetadata, kept as it was read.

public PsdResource(int Id, string Name, ReadOnlyMemory<byte> Data)

Parameters

Id int

The resource's number, such as 1036 for the thumbnail.

Name string

The resource's name, usually empty.

Data ReadOnlyMemory<byte>

The resource's data.

Examples

using Raster image = Raster.Load("photo.psd");
var details = (PsdDetails)image.Metadata.FormatDetails!;
Console.WriteLine($"{(details.Version == 2 ? "PSB" : "PSD")}, {details.ColorMode} at {details.BitsPerChannel} bits, {details.ChannelCount} channels, {details.Compression}");
if (!details.HasRealComposite)
{
    // Saved without Maximize Compatibility: what loaded is Photoshop's placeholder, and a warning says so.
    Console.WriteLine("Save the file again with Maximize Compatibility on.");
}

foreach (PsdResource resource in details.OtherResources)
{
    Console.WriteLine($"Resource {resource.Id}, {resource.Data.Length} bytes");
}

Properties

Data

The resource's data.

public ReadOnlyMemory<byte> Data { get; init; }

Property Value

ReadOnlyMemory<byte>

Id

The resource's number, such as 1036 for the thumbnail.

public int Id { get; init; }

Property Value

int

Name

The resource's name, usually empty.

public string Name { get; init; }

Property Value

string