Class Configuration
Provides configuration which allows altering default behaviour or extending the library.
Inherited Members
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public sealed class Configuration
Constructors
| Edit this page View SourceConfiguration()
Initializes a new instance of the Configuration class.
Declaration
public Configuration()
Configuration(params IImageFormatConfigurationModule[])
Initializes a new instance of the Configuration class.
Declaration
public Configuration(params IImageFormatConfigurationModule[] configurationModules)
Parameters
| Type | Name | Description |
|---|---|---|
| IImageFormatConfigurationModule[] | configurationModules | A collection of configuration modules to register. |
Properties
| Edit this page View SourceDefault
Gets the default Configuration instance.
Declaration
public static Configuration Default { get; }
Property Value
| Type | Description |
|---|---|
| Configuration |
ImageFormats
Gets the currently registered IImageFormats.
Declaration
public IEnumerable<IImageFormat> ImageFormats { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<IImageFormat> |
ImageFormatsManager
Gets or the ImageFormatManager that is currently in use.
Declaration
public ImageFormatManager ImageFormatsManager { get; }
Property Value
| Type | Description |
|---|---|
| ImageFormatManager |
MaxDegreeOfParallelism
Gets or sets the maximum number of concurrent tasks enabled in ImageSharp algorithms configured with this Configuration instance. Initialized with ProcessorCount by default.
Declaration
public int MaxDegreeOfParallelism { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
MemoryAllocator
Gets or sets the MemoryAllocator that is currently in use. Defaults to Default.
Allocators are expensive, so it is strongly recommended to use only one busy instance per process. In case you need to customize it, you can ensure this by changingDeclaration
public MemoryAllocator MemoryAllocator { get; set; }
Property Value
| Type | Description |
|---|---|
| MemoryAllocator |
Remarks
It's possible to reduce allocator footprint by assigning a custom instance created with Create(MemoryAllocatorOptions), but note that since the default pooling allocators are expensive, it is strictly recommended to use a single process-wide allocator. You can ensure this by altering the allocator of Default, or by implementing custom application logic that manages allocator lifetime.
If an allocator has to be dropped for some reason, ReleaseRetainedResources() shall be invoked after disposing all associated Image instances.PreferContiguousImageBuffers
Gets or sets a value indicating whether to force image buffers to be contiguous whenever possible.
Declaration
public bool PreferContiguousImageBuffers { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Contiguous allocations are not possible, if the image needs a buffer larger than MaxValue.
Properties
Gets a set of properties for the Configuration.
Declaration
public IDictionary<object, object> Properties { get; }
Property Value
| Type | Description |
|---|---|
| IDictionary<object, object> |
Remarks
This can be used for storing global settings and defaults to be accessible to processors.
ReadOrigin
Gets or sets the position in a stream to use for reading when using a seekable stream as an image data source.
Declaration
public ReadOrigin ReadOrigin { get; set; }
Property Value
| Type | Description |
|---|---|
| ReadOrigin |
StreamProcessingBufferSize
Gets or sets the size of the buffer to use when working with streams. Initialized with SixLabors.ImageSharp.Configuration.DefaultStreamProcessingBufferSize by default.
Declaration
public int StreamProcessingBufferSize { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceClone()
Creates a shallow copy of the Configuration.
Declaration
public Configuration Clone()
Returns
| Type | Description |
|---|---|
| Configuration | A new configuration instance. |
Configure(IImageFormatConfigurationModule)
Registers a new format provider.
Declaration
public void Configure(IImageFormatConfigurationModule configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| IImageFormatConfigurationModule | configuration | The configuration provider to call configure on. |