Class TgaDetails
Details only TGA has, kept in FormatDetails.
public sealed class TgaDetails : FormatDetails
- Inheritance
-
TgaDetails
- 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
AlphaType
Gets or sets the alpha type from the TGA 2.0 extension area, or null if the file had none.
public TgaAlphaType? AlphaType { get; set; }
Property Value
AttributeBits
Gets or sets the number of attribute (alpha) bits a pixel from the image descriptor.
public int AttributeBits { get; set; }
Property Value
BitsPerPixel
Gets or sets the bits a pixel: 8, 15, 16, 24 or 32.
public int BitsPerPixel { get; set; }
Property Value
ImageId
Gets or sets the image ID field, up to 255 bytes. Empty if the file had none.
public ReadOnlyMemory<byte> ImageId { get; set; }
Property Value
ImageType
Gets or sets the image type from the header: 1, 2 or 3, or 9, 10 or 11 when run-length encoded.
public int ImageType { get; set; }
Property Value
JobName
Gets or sets the job name from the extension area. null if absent.
public string? JobName { get; set; }
Property Value
Origin
Gets or sets where the first stored pixel goes.
public TgaOrigin Origin { get; set; }
Property Value
PixelAspectRatio
Gets or sets the pixel aspect ratio (width over height) from the extension area, or null if absent.
public double? PixelAspectRatio { get; set; }
Property Value
Software
Gets or sets the software ID from the extension area. null if absent.
public string? Software { get; set; }
Property Value
Timestamp
Gets or sets the date and time from the extension area, or null if absent or invalid.
public DateTime? Timestamp { get; set; }
Property Value
Methods
Copy()
Returns a deep copy.
public override FormatDetails Copy()
Returns
- FormatDetails
The copy.