Class WebpChunk
A chunk Egami does not read itself, kept unchanged for round trips.
public sealed record WebpChunk : IEquatable<WebpChunk>
- Inheritance
-
WebpChunk
- Implements
- 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");
}
Constructors
WebpChunk(string, ReadOnlyMemory<byte>, WebpChunkPosition)
A chunk Egami does not read itself, kept unchanged for round trips.
public WebpChunk(string Type, ReadOnlyMemory<byte> Data, WebpChunkPosition Position)
Parameters
TypestringThe four-character chunk type, such as "TEST".
DataReadOnlyMemory<byte>The chunk data, without its padding byte.
PositionWebpChunkPositionWhere the chunk sat.
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
Data
The chunk data, without its padding byte.
public ReadOnlyMemory<byte> Data { get; init; }
Property Value
Position
Where the chunk sat.
public WebpChunkPosition Position { get; init; }
Property Value
Type
The four-character chunk type, such as "TEST".
public string Type { get; init; }