Class BmpDetails
Details only BMP has, kept in FormatDetails.
public sealed class BmpDetails : FormatDetails
- Inheritance
-
BmpDetails
- 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
BitsPerPixel
Gets or sets the bits a pixel: 1, 2, 4, 8, 16, 24 or 32 (0 for embedded JPEG or PNG).
public int BitsPerPixel { get; set; }
Property Value
Compression
Gets or sets how the pixels were stored.
public BmpCompression Compression { get; set; }
Property Value
HeaderSize
Gets or sets the size of the info header: 12, 16, 40, 52, 56, 64, 108 or 124. Defaults to 40.
public int HeaderSize { get; set; }
Property Value
Palette
Gets or sets the palette. Empty if the file had none.
public ReadOnlyMemory<Rgb8> Palette { get; set; }
Property Value
TopDown
Gets or sets whether the rows were stored top-down (a negative height) rather than bottom-up.
public bool TopDown { get; set; }
Property Value
Methods
Copy()
Returns a deep copy.
public override FormatDetails Copy()
Returns
- FormatDetails
The copy.