ImageInfo Class

A snapshot of the information that can be determined about an encoded image without decoding its pixels.

public sealed class ImageInfo

Remarks

Instances are produced by Image.Identify and by ImageReader<TPixel>.Info. Values that cannot be determined from the examined part of the file are null; they are never guessed. In ImageIdentifyMode.Header mode, the frame count of a GIF file, for instance, is unknown.

ImageInfo.Metadata and ImageInfo.Animation are detached copies owned by this instance: modifying them does not affect any image, reader, or other ImageInfo.

Properties

NameDescription
AnimationGets the animation-wide information (such as the number of plays), or null if the file is not known to be animated.
BitsPerComponentGets the precision of the encoded samples, in bits per component (for example 1, 2, 4, 8 or 16 for PNG; 8, 10 or 12 for AVIF; 8 to 12 for HEIC; 1 to 16 for JPEG XL and JPEG 2000; 16, 24 or 32 for the floating-point samples of TIFF, whose ImageInfo.PixelFormat is PixelFormat.RgbaHalf or PixelFormat.RgbaFloat; 16 (HALF) or 32 (FLOAT or UINT) for OpenEXR).
CollectionEntryCountGets the number of entries of a multi-entry container (the pages of a TIFF document, the representations of an icon), or null for a single-image format or when the examined part of the file does not say.
ColorModelGets the color model of the encoded samples.
FormatGets the detected encoded format.
FrameCountGets the number of displayed animation frames (excluding a separate poster frame), or null when unknown.
HasPosterFrameGets a value indicating whether the file contains a separate poster frame (APNG default image that is not part of the animation), or null when unknown.
HeightGets the canvas height, in pixels.
IdentifyModeGets the mode used to produce this snapshot.
IsAnimatedGets a value indicating whether the file is an animation, or null when unknown.
MayHaveTransparencyGets a value indicating whether the encoding is capable of producing non-opaque pixels (alpha channel, transparency chunk, or transparent palette index), or null when unknown. This is not the result of a pixel scan.
MetadataGets the metadata found in the examined part of the file.
PixelFormatGets the pixel format that the untyped Image.Load overloads produce for this file (the default working representation).
SizeGets the canvas size, in pixels.
WidthGets the canvas width, in pixels.

Animation

ImageInfo.cs

Gets the animation-wide information (such as the number of plays), or null if the file is not known to be animated.

public AnimationMetadata? Animation { get; }

Property value

AnimationMetadata?

BitsPerComponent

ImageInfo.cs

Gets the precision of the encoded samples, in bits per component (for example 1, 2, 4, 8 or 16 for PNG; 8, 10 or 12 for AVIF; 8 to 12 for HEIC; 1 to 16 for JPEG XL and JPEG 2000; 16, 24 or 32 for the floating-point samples of TIFF, whose ImageInfo.PixelFormat is PixelFormat.RgbaHalf or PixelFormat.RgbaFloat; 16 (HALF) or 32 (FLOAT or UINT) for OpenEXR).

public int BitsPerComponent { get; }

Property value

int

CollectionEntryCount

ImageInfo.cs

Gets the number of entries of a multi-entry container (the pages of a TIFF document, the representations of an icon), or null for a single-image format or when the examined part of the file does not say.

public int? CollectionEntryCount { get; }

Property value

int?

Remarks

Entries are never animation frames: ImageInfo.FrameCount describes the image this snapshot is about (the first page, or the default representation) and stays 1. Use ImageCollection to reach the other entries.

ColorModel

ImageInfo.cs

Gets the color model of the encoded samples.

public ImageColorModel ColorModel { get; }

Property value

ImageColorModel

Gets the detected encoded format.

public ImageFormat Format { get; }

Property value

ImageFormat

FrameCount

ImageInfo.cs

Gets the number of displayed animation frames (excluding a separate poster frame), or null when unknown.

public int? FrameCount { get; }

Property value

int?

HasPosterFrame

ImageInfo.cs

Gets a value indicating whether the file contains a separate poster frame (APNG default image that is not part of the animation), or null when unknown.

public bool? HasPosterFrame { get; }

Property value

bool?

Gets the canvas height, in pixels.

public int Height { get; }

Property value

int

IdentifyMode

ImageInfo.cs

Gets the mode used to produce this snapshot.

public ImageIdentifyMode IdentifyMode { get; }

Property value

ImageIdentifyMode

IsAnimated

ImageInfo.cs

Gets a value indicating whether the file is an animation, or null when unknown.

public bool? IsAnimated { get; }

Property value

bool?

MayHaveTransparency

ImageInfo.cs

Gets a value indicating whether the encoding is capable of producing non-opaque pixels (alpha channel, transparency chunk, or transparent palette index), or null when unknown. This is not the result of a pixel scan.

public bool? MayHaveTransparency { get; }

Property value

bool?

Metadata

ImageInfo.cs

Gets the metadata found in the examined part of the file.

public ImageMetadata Metadata { get; }

Property value

ImageMetadata

PixelFormat

ImageInfo.cs

Gets the pixel format that the untyped Image.Load overloads produce for this file (the default working representation).

public PixelFormat PixelFormat { get; }

Property value

PixelFormat

Gets the canvas size, in pixels.

public Size Size { get; }

Property value

Size

Gets the canvas width, in pixels.

public int Width { get; }

Property value

int