Class ImageFormatManager
Collection of Image Formats to be used in Configuration class.
Inherited Members
Namespace: SixLabors.ImageSharp.Formats
Assembly: SixLabors.ImageSharp.dll
Syntax
public class ImageFormatManager
Constructors
| Edit this page View SourceImageFormatManager()
Initializes a new instance of the ImageFormatManager class.
Declaration
public ImageFormatManager()
Properties
| Edit this page View SourceImageFormats
Gets the currently registered IImageFormats.
Declaration
public IEnumerable<IImageFormat> ImageFormats { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IImageFormat> |
Methods
| Edit this page View SourceAddImageFormat(IImageFormat)
Registers a new format provider.
Declaration
public void AddImageFormat(IImageFormat format)
Parameters
Type | Name | Description |
---|---|---|
IImageFormat | format | The format to register as a known format. |
AddImageFormatDetector(IImageFormatDetector)
Adds a new detector for detecting mime types.
Declaration
public void AddImageFormatDetector(IImageFormatDetector detector)
Parameters
Type | Name | Description |
---|---|---|
IImageFormatDetector | detector | The detector to add |
ClearImageFormatDetectors()
Removes all the registered image format detectors.
Declaration
public void ClearImageFormatDetectors()
GetDecoder(IImageFormat)
For the specified mime type find the decoder.
Declaration
public IImageDecoder GetDecoder(IImageFormat format)
Parameters
Type | Name | Description |
---|---|---|
IImageFormat | format | The format to discover |
Returns
Type | Description |
---|---|
IImageDecoder | The IImageDecoder. |
Exceptions
Type | Condition |
---|---|
UnknownImageFormatException | The format is not registered. |
GetEncoder(IImageFormat)
For the specified mime type find the encoder.
Declaration
public IImageEncoder GetEncoder(IImageFormat format)
Parameters
Type | Name | Description |
---|---|---|
IImageFormat | format | The format to discover |
Returns
Type | Description |
---|---|
IImageEncoder | The IImageEncoder. |
Exceptions
Type | Condition |
---|---|
UnknownImageFormatException | The format is not registered. |
SetDecoder(IImageFormat, IImageDecoder)
Sets a specific image decoder as the decoder for a specific image format.
Declaration
public void SetDecoder(IImageFormat imageFormat, IImageDecoder decoder)
Parameters
Type | Name | Description |
---|---|---|
IImageFormat | imageFormat | The image format to register the encoder for. |
IImageDecoder | decoder | The decoder to use, |
SetEncoder(IImageFormat, IImageEncoder)
Sets a specific image encoder as the encoder for a specific image format.
Declaration
public void SetEncoder(IImageFormat imageFormat, IImageEncoder encoder)
Parameters
Type | Name | Description |
---|---|---|
IImageFormat | imageFormat | The image format to register the encoder for. |
IImageEncoder | encoder | The encoder to use, |
TryFindFormatByFileExtension(string, out IImageFormat?)
For the specified file extensions type find the e IImageFormat.
Declaration
public bool TryFindFormatByFileExtension(string extension, out IImageFormat? format)
Parameters
Type | Name | Description |
---|---|---|
string | extension | The extension to return the format for. |
IImageFormat | format | When this method returns, contains the format that matches the given extension;
otherwise, the default value for the type of the |
Returns
Type | Description |
---|---|
bool |
TryFindFormatByMimeType(string, out IImageFormat?)
For the specified mime type find the IImageFormat.
Declaration
public bool TryFindFormatByMimeType(string mimeType, out IImageFormat? format)
Parameters
Type | Name | Description |
---|---|---|
string | mimeType | The mime-type to return the format for. |
IImageFormat | format | When this method returns, contains the format that matches the given mime-type;
otherwise, the default value for the type of the |
Returns
Type | Description |
---|---|
bool |