Table of Contents

Class WebpDetails

Namespace
Egami.Formats.Webp
Assembly
Egami.dll

Details only WebP has, kept in FormatDetails so a WebP can be written back as it was.

public sealed class WebpDetails : FormatDetails
Inheritance
WebpDetails
Inherited Members

Examples

using Raster<Rgba8> image = Raster.Load<Rgba8>("duck.webp");
WebpDetails webp = (WebpDetails)image.Metadata.FormatDetails!;
Console.WriteLine($"{(webp.Lossless ? "lossless" : "lossy")}, extended: {webp.Extended}, alpha: {webp.HasAlpha}");

// Chunks Egami does not read are kept and written back where they were.
foreach (WebpChunk chunk in webp.OtherChunks)
{
    Console.WriteLine($"{chunk.Type}: {chunk.Data.Length} bytes, {chunk.Position}");
}

// An animation's frames say whether each was stored lossless.
foreach (Frame<Rgba8> frame in image.Frames)
{
    Console.WriteLine(frame.Metadata.FormatDetails is WebpFrameDetails { Lossless: true } ? "lossless frame" : "lossy frame");
}

Properties

BackgroundColor

Gets or sets an animation's background color from its ANIM chunk. RFC 9649 makes it a hint: Egami starts the canvas transparent, as libwebp and browsers do, unless UseBackgroundColor is set. Defaults to opaque white, which libwebp's animation encoder also writes.

public Rgba8 BackgroundColor { get; set; }

Property Value

Rgba8

Extended

Gets or sets whether the file used the extended format (a VP8X chunk), which metadata, alpha in lossy files and animation need.

public bool Extended { get; set; }

Property Value

bool

HasAlpha

Gets or sets whether the file said it has alpha (the VP8X flag, the VP8L alpha hint or an ALPH chunk).

public bool HasAlpha { get; set; }

Property Value

bool

Lossless

Gets or sets whether the still image, or an animation's first frame, was lossless (VP8L) rather than lossy (VP8). Saving to WebP with Lossless left at null keeps this kind.

public bool Lossless { get; set; }

Property Value

bool

OtherChunks

Gets the chunks Egami does not read itself, in file order, written back in the same place unless metadata is stripped.

public IList<WebpChunk> OtherChunks { get; }

Property Value

IList<WebpChunk>

Methods

Copy()

Returns a deep copy.

public override FormatDetails Copy()

Returns

FormatDetails

The copy.