Table of Contents

Class ImageFormats

Namespace
LMKit.Media.Image
Assembly
LM-Kit.NET.dll

Public registry of the image formats the toolkit knows: their file extensions and MIME types, backed by the toolkit's single internal format table. Use it to build hosts and clients that stay in lockstep with the toolkit as formats are added, instead of hardcoding extension or MIME lists that drift.

public static class ImageFormats
Inheritance
ImageFormats
Inherited Members

Examples

using LMKit.Media.Image;

string mime = ImageFormats.GetMimeType(".heif");        // "image/heic"
string extension = ImageFormats.GetExtension("image/tiff"); // ".tif"
bool accepted = ImageFormats.SupportedExtensions.Contains(".avif"); // true

Remarks

SupportedExtensions is the image slice of SupportedFileExtensions: every extension of every format the imaging runtime decodes. The lookup methods also answer for formats the runtime only identifies without decoding (for example DDS or QOI), since labeling a file is useful even when its pixels are never read.

Properties

EncodableExtensions

Gets every file extension of every image format the toolkit ENCODES, in canonical form (lowercase, dot-prefixed, sorted): the honest list of what Save(string, ImageEncoderOptions) writes. The toolkit decodes more than it encodes, so this is a subset of SupportedExtensions.

SupportedExtensions

Gets every file extension of every image format the imaging runtime decodes, in canonical form: lowercase, dot-prefixed, sorted, no duplicates (for example ".png", ".jpg", ".heic").

Methods

GetExtension(ImageOutputFormat)

The canonical extension of an output format, lowercase and dot-prefixed (for example ".jpg").

GetExtension(string)

Resolves a MIME type to the canonical file extension of the image format it identifies.

GetMimeType(ImageOutputFormat)

The MIME type of an output format (for example image/jpeg).

GetMimeType(string)

Resolves a file extension to the MIME type of the image format it belongs to.

TryGetOutputFormat(string, out ImageOutputFormat)

Resolves a file extension (with or without the leading dot, any casing) to the output format the toolkit writes for it; false for an extension of a format it only decodes or does not know.

Share