Table of Contents

Class ImageFormatManager

Namespace
SixLabors.ImageSharp.Formats
Assembly
SixLabors.ImageSharp.dll

Collection of Image Formats to be used in Configuration class.

public class ImageFormatManager
Inheritance
ImageFormatManager
Inherited Members

Constructors

ImageFormatManager()

Initializes a new instance of the ImageFormatManager class.

public ImageFormatManager()

Properties

ImageFormats

Gets the currently registered IImageFormats.

public IEnumerable<IImageFormat> ImageFormats { get; }

Property Value

IEnumerable<IImageFormat>

Methods

AddImageFormat(IImageFormat)

Registers a new format provider.

public void AddImageFormat(IImageFormat format)

Parameters

format IImageFormat

The format to register as a known format.

AddImageFormatDetector(IImageFormatDetector)

Adds a new detector for detecting mime types.

public void AddImageFormatDetector(IImageFormatDetector detector)

Parameters

detector IImageFormatDetector

The detector to add

ClearImageFormatDetectors()

Removes all the registered image format detectors.

public void ClearImageFormatDetectors()

GetDecoder(IImageFormat)

For the specified mime type find the decoder.

public IImageDecoder GetDecoder(IImageFormat format)

Parameters

format IImageFormat

The format to discover

Returns

IImageDecoder

The IImageDecoder.

Exceptions

UnknownImageFormatException

The format is not registered.

GetEncoder(IImageFormat)

For the specified mime type find the encoder.

public IImageEncoder GetEncoder(IImageFormat format)

Parameters

format IImageFormat

The format to discover

Returns

IImageEncoder

The IImageEncoder.

Exceptions

UnknownImageFormatException

The format is not registered.

SetDecoder(IImageFormat, IImageDecoder)

Sets a specific image decoder as the decoder for a specific image format.

public void SetDecoder(IImageFormat imageFormat, IImageDecoder decoder)

Parameters

imageFormat IImageFormat

The image format to register the encoder for.

decoder IImageDecoder

The decoder to use,

SetEncoder(IImageFormat, IImageEncoder)

Sets a specific image encoder as the encoder for a specific image format.

public void SetEncoder(IImageFormat imageFormat, IImageEncoder encoder)

Parameters

imageFormat IImageFormat

The image format to register the encoder for.

encoder IImageEncoder

The encoder to use,

TryFindFormatByFileExtension(string, out IImageFormat?)

For the specified file extensions type find the e IImageFormat.

public bool TryFindFormatByFileExtension(string extension, out IImageFormat? format)

Parameters

extension string

The extension to return the format for.

format IImageFormat

When this method returns, contains the format that matches the given extension; otherwise, the default value for the type of the format parameter. This parameter is passed uninitialized.

Returns

bool

true if a match is found; otherwise, false

TryFindFormatByMimeType(string, out IImageFormat?)

For the specified mime type find the IImageFormat.

public bool TryFindFormatByMimeType(string mimeType, out IImageFormat? format)

Parameters

mimeType string

The mime-type to return the format for.

format IImageFormat

When this method returns, contains the format that matches the given mime-type; otherwise, the default value for the type of the format parameter. This parameter is passed uninitialized.

Returns

bool

true if a match is found; otherwise, false