Table of Contents

Class PngDetails

Namespace
Egami.Formats.Png
Assembly
Egami.dll

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

public sealed class PngDetails : FormatDetails
Inheritance
PngDetails
Inherited Members

Examples

// Each reader fills in what the file's header says, in the format's own terms.
using Raster png = Raster.Load("duck.png");
if (png.Metadata.FormatDetails is PngDetails pngDetails)
{
    Console.WriteLine($"PNG {pngDetails.ColorType}, {pngDetails.BitDepth}-bit, interlaced: {pngDetails.Interlaced}");
    foreach (PngTextSource source in pngDetails.TextSources)
    {
        Console.WriteLine($"Text from a {source.ChunkType} chunk, compressed: {source.Compressed}");
    }
}

using Raster bmp = Raster.Load("duck.bmp");
BmpDetails bmpDetails = (BmpDetails)bmp.Metadata.FormatDetails!;
Console.WriteLine($"BMP {bmpDetails.BitsPerPixel}-bit, {bmpDetails.Compression}, {bmpDetails.HeaderSize}-byte header");

using Raster tga = Raster.Load("duck.tga");
TgaDetails tgaDetails = (TgaDetails)tga.Metadata.FormatDetails!;
Console.WriteLine($"TGA type {tgaDetails.ImageType}, origin {tgaDetails.Origin}, alpha {tgaDetails.AlphaType}");

using Raster qoi = Raster.Load("duck.qoi");
QoiDetails qoiDetails = (QoiDetails)qoi.Metadata.FormatDetails!;
Console.WriteLine($"QOI {qoiDetails.Channels} channels, linear: {qoiDetails.Linear}");

using Raster pgm = Raster.Load("duck.pgm");
PnmDetails pnmDetails = (PnmDetails)pgm.Metadata.FormatDetails!;
Console.WriteLine($"PNM {pnmDetails.Kind}, maxval {pnmDetails.MaxValue}, plain text: {pnmDetails.PlainText}");

Properties

Animated

Gets or sets whether the file is an APNG (has a valid acTL chunk).

public bool Animated { get; set; }

Property Value

bool

BitDepth

Gets or sets the original bit depth.

public int BitDepth { get; set; }

Property Value

int

Chromaticities

Gets or sets the raw cHRM data (32 bytes). Empty if the file had none.

public ReadOnlyMemory<byte> Chromaticities { get; set; }

Property Value

ReadOnlyMemory<byte>

CodingIndependentCodePoints

Gets or sets the raw cICP data (4 bytes). Empty if the file had none.

public ReadOnlyMemory<byte> CodingIndependentCodePoints { get; set; }

Property Value

ReadOnlyMemory<byte>

ColorType

Gets or sets the original color type.

public PngColorType ColorType { get; set; }

Property Value

PngColorType

DefaultImageIsFrame

Gets or sets whether an APNG's default image (IDAT) is its first frame. When it is not, it is a still for viewers without APNG support, and the reader skips it.

public bool DefaultImageIsFrame { get; set; }

Property Value

bool

FileGamma

Gets or sets the gAMA value as stored: the file gamma times 100,000.

public uint? FileGamma { get; set; }

Property Value

uint?

IccProfileName

Gets or sets the ICC profile name from iCCP.

public string? IccProfileName { get; set; }

Property Value

string

Interlaced

Gets or sets a value indicating whether the file was Adam7 interlaced.

public bool Interlaced { get; set; }

Property Value

bool

OtherChunks

Gets the other chunks kept unchanged, such as bKGD and tIME, in file order.

public IList<PngChunk> OtherChunks { get; }

Property Value

IList<PngChunk>

Palette

Gets or sets the palette (PLTE), with alpha from tRNS. Empty if the file had none.

public ReadOnlyMemory<Rgba8> Palette { get; set; }

Property Value

ReadOnlyMemory<Rgba8>

ResolutionHasUnit

Gets or sets a value indicating whether pHYs gave a unit (meter) rather than only an aspect ratio.

public bool? ResolutionHasUnit { get; set; }

Property Value

bool?

SrgbRenderingIntent

Gets or sets the sRGB rendering intent, 0 to 3, if the file had an sRGB chunk.

public byte? SrgbRenderingIntent { get; set; }

Property Value

byte?

TextSources

Gets the chunk each entry of Text came from, in the same order.

public IList<PngTextSource> TextSources { get; }

Property Value

IList<PngTextSource>

Transparency

Gets or sets the raw tRNS data. Empty if the file had none.

public ReadOnlyMemory<byte> Transparency { get; set; }

Property Value

ReadOnlyMemory<byte>

Methods

Copy()

Returns a deep copy.

public override FormatDetails Copy()

Returns

FormatDetails

The copy.