Class ImageExtensions
Extension methods for the Image type.
Inherited Members
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public static class ImageExtensionsMethods
| Improve this Doc View SourceSave(Image, Stream, IImageFormat)
Writes the image to the given stream using the given image format.
Declaration
public static void Save(this Image source, Stream stream, IImageFormat format)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The source image. | 
| Stream | stream | The stream to save the image to. | 
| IImageFormat | format | The format to save the image in. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The stream is null. | 
| ArgumentNullException | The format is null. | 
| NotSupportedException | The stream is not writable. | 
| NotSupportedException | No encoder available for provided format. | 
Save(Image, String)
Writes the image to the given file path using an encoder detected from the path.
Declaration
public static void Save(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The source image. | 
| String | path | The file path to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The path is null. | 
| NotSupportedException | No encoder available for provided path. | 
Save(Image, String, IImageEncoder)
Writes the image to the given file path using the given image encoder.
Declaration
public static void Save(this Image source, string path, IImageEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The source image. | 
| String | path | The file path to save the image to. | 
| IImageEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The path is null. | 
| ArgumentNullException | The encoder is null. | 
SaveAsBmp(Image, Stream)
Saves the image to the given stream with the Bmp format.
Declaration
public static void SaveAsBmp(this Image source, Stream stream)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsBmp(Image, Stream, BmpEncoder)
Saves the image to the given stream with the Bmp format.
Declaration
public static void SaveAsBmp(this Image source, Stream stream, BmpEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| BmpEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsBmp(Image, String)
Saves the image to the given stream with the Bmp format.
Declaration
public static void SaveAsBmp(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsBmp(Image, String, BmpEncoder)
Saves the image to the given stream with the Bmp format.
Declaration
public static void SaveAsBmp(this Image source, string path, BmpEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| BmpEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsBmpAsync(Image, Stream, BmpEncoder, CancellationToken)
Saves the image to the given stream with the Bmp format.
Declaration
public static Task SaveAsBmpAsync(this Image source, Stream stream, BmpEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| BmpEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsBmpAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Bmp format.
Declaration
public static Task SaveAsBmpAsync(this Image source, Stream stream, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsBmpAsync(Image, String)
Saves the image to the given stream with the Bmp format.
Declaration
public static Task SaveAsBmpAsync(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsBmpAsync(Image, String, BmpEncoder, CancellationToken)
Saves the image to the given stream with the Bmp format.
Declaration
public static Task SaveAsBmpAsync(this Image source, string path, BmpEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| BmpEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsBmpAsync(Image, String, CancellationToken)
Saves the image to the given stream with the Bmp format.
Declaration
public static Task SaveAsBmpAsync(this Image source, string path, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsGif(Image, Stream)
Saves the image to the given stream with the Gif format.
Declaration
public static void SaveAsGif(this Image source, Stream stream)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsGif(Image, Stream, GifEncoder)
Saves the image to the given stream with the Gif format.
Declaration
public static void SaveAsGif(this Image source, Stream stream, GifEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| GifEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsGif(Image, String)
Saves the image to the given stream with the Gif format.
Declaration
public static void SaveAsGif(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsGif(Image, String, GifEncoder)
Saves the image to the given stream with the Gif format.
Declaration
public static void SaveAsGif(this Image source, string path, GifEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| GifEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsGifAsync(Image, Stream, GifEncoder, CancellationToken)
Saves the image to the given stream with the Gif format.
Declaration
public static Task SaveAsGifAsync(this Image source, Stream stream, GifEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| GifEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsGifAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Gif format.
Declaration
public static Task SaveAsGifAsync(this Image source, Stream stream, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsGifAsync(Image, String)
Saves the image to the given stream with the Gif format.
Declaration
public static Task SaveAsGifAsync(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsGifAsync(Image, String, GifEncoder, CancellationToken)
Saves the image to the given stream with the Gif format.
Declaration
public static Task SaveAsGifAsync(this Image source, string path, GifEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| GifEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsGifAsync(Image, String, CancellationToken)
Saves the image to the given stream with the Gif format.
Declaration
public static Task SaveAsGifAsync(this Image source, string path, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsJpeg(Image, Stream)
Saves the image to the given stream with the Jpeg format.
Declaration
public static void SaveAsJpeg(this Image source, Stream stream)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsJpeg(Image, Stream, JpegEncoder)
Saves the image to the given stream with the Jpeg format.
Declaration
public static void SaveAsJpeg(this Image source, Stream stream, JpegEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| JpegEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsJpeg(Image, String)
Saves the image to the given stream with the Jpeg format.
Declaration
public static void SaveAsJpeg(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsJpeg(Image, String, JpegEncoder)
Saves the image to the given stream with the Jpeg format.
Declaration
public static void SaveAsJpeg(this Image source, string path, JpegEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| JpegEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsJpegAsync(Image, Stream, JpegEncoder, CancellationToken)
Saves the image to the given stream with the Jpeg format.
Declaration
public static Task SaveAsJpegAsync(this Image source, Stream stream, JpegEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| JpegEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsJpegAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Jpeg format.
Declaration
public static Task SaveAsJpegAsync(this Image source, Stream stream, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsJpegAsync(Image, String)
Saves the image to the given stream with the Jpeg format.
Declaration
public static Task SaveAsJpegAsync(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsJpegAsync(Image, String, JpegEncoder, CancellationToken)
Saves the image to the given stream with the Jpeg format.
Declaration
public static Task SaveAsJpegAsync(this Image source, string path, JpegEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| JpegEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsJpegAsync(Image, String, CancellationToken)
Saves the image to the given stream with the Jpeg format.
Declaration
public static Task SaveAsJpegAsync(this Image source, string path, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsPbm(Image, Stream)
Saves the image to the given stream with the Pbm format.
Declaration
public static void SaveAsPbm(this Image source, Stream stream)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsPbm(Image, Stream, PbmEncoder)
Saves the image to the given stream with the Pbm format.
Declaration
public static void SaveAsPbm(this Image source, Stream stream, PbmEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| PbmEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsPbm(Image, String)
Saves the image to the given stream with the Pbm format.
Declaration
public static void SaveAsPbm(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsPbm(Image, String, PbmEncoder)
Saves the image to the given stream with the Pbm format.
Declaration
public static void SaveAsPbm(this Image source, string path, PbmEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| PbmEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsPbmAsync(Image, Stream, PbmEncoder, CancellationToken)
Saves the image to the given stream with the Pbm format.
Declaration
public static Task SaveAsPbmAsync(this Image source, Stream stream, PbmEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| PbmEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsPbmAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Pbm format.
Declaration
public static Task SaveAsPbmAsync(this Image source, Stream stream, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsPbmAsync(Image, String)
Saves the image to the given stream with the Pbm format.
Declaration
public static Task SaveAsPbmAsync(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsPbmAsync(Image, String, PbmEncoder, CancellationToken)
Saves the image to the given stream with the Pbm format.
Declaration
public static Task SaveAsPbmAsync(this Image source, string path, PbmEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| PbmEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsPbmAsync(Image, String, CancellationToken)
Saves the image to the given stream with the Pbm format.
Declaration
public static Task SaveAsPbmAsync(this Image source, string path, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsPng(Image, Stream)
Saves the image to the given stream with the Png format.
Declaration
public static void SaveAsPng(this Image source, Stream stream)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsPng(Image, Stream, PngEncoder)
Saves the image to the given stream with the Png format.
Declaration
public static void SaveAsPng(this Image source, Stream stream, PngEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| PngEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsPng(Image, String)
Saves the image to the given stream with the Png format.
Declaration
public static void SaveAsPng(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsPng(Image, String, PngEncoder)
Saves the image to the given stream with the Png format.
Declaration
public static void SaveAsPng(this Image source, string path, PngEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| PngEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsPngAsync(Image, Stream, PngEncoder, CancellationToken)
Saves the image to the given stream with the Png format.
Declaration
public static Task SaveAsPngAsync(this Image source, Stream stream, PngEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| PngEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsPngAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Png format.
Declaration
public static Task SaveAsPngAsync(this Image source, Stream stream, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsPngAsync(Image, String)
Saves the image to the given stream with the Png format.
Declaration
public static Task SaveAsPngAsync(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsPngAsync(Image, String, PngEncoder, CancellationToken)
Saves the image to the given stream with the Png format.
Declaration
public static Task SaveAsPngAsync(this Image source, string path, PngEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| PngEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsPngAsync(Image, String, CancellationToken)
Saves the image to the given stream with the Png format.
Declaration
public static Task SaveAsPngAsync(this Image source, string path, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsTga(Image, Stream)
Saves the image to the given stream with the Tga format.
Declaration
public static void SaveAsTga(this Image source, Stream stream)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsTga(Image, Stream, TgaEncoder)
Saves the image to the given stream with the Tga format.
Declaration
public static void SaveAsTga(this Image source, Stream stream, TgaEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| TgaEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsTga(Image, String)
Saves the image to the given stream with the Tga format.
Declaration
public static void SaveAsTga(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsTga(Image, String, TgaEncoder)
Saves the image to the given stream with the Tga format.
Declaration
public static void SaveAsTga(this Image source, string path, TgaEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| TgaEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsTgaAsync(Image, Stream, TgaEncoder, CancellationToken)
Saves the image to the given stream with the Tga format.
Declaration
public static Task SaveAsTgaAsync(this Image source, Stream stream, TgaEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| TgaEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsTgaAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Tga format.
Declaration
public static Task SaveAsTgaAsync(this Image source, Stream stream, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsTgaAsync(Image, String)
Saves the image to the given stream with the Tga format.
Declaration
public static Task SaveAsTgaAsync(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsTgaAsync(Image, String, TgaEncoder, CancellationToken)
Saves the image to the given stream with the Tga format.
Declaration
public static Task SaveAsTgaAsync(this Image source, string path, TgaEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| TgaEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsTgaAsync(Image, String, CancellationToken)
Saves the image to the given stream with the Tga format.
Declaration
public static Task SaveAsTgaAsync(this Image source, string path, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsTiff(Image, Stream)
Saves the image to the given stream with the Tiff format.
Declaration
public static void SaveAsTiff(this Image source, Stream stream)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsTiff(Image, Stream, TiffEncoder)
Saves the image to the given stream with the Tiff format.
Declaration
public static void SaveAsTiff(this Image source, Stream stream, TiffEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| TiffEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsTiff(Image, String)
Saves the image to the given stream with the Tiff format.
Declaration
public static void SaveAsTiff(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsTiff(Image, String, TiffEncoder)
Saves the image to the given stream with the Tiff format.
Declaration
public static void SaveAsTiff(this Image source, string path, TiffEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| TiffEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsTiffAsync(Image, Stream, TiffEncoder, CancellationToken)
Saves the image to the given stream with the Tiff format.
Declaration
public static Task SaveAsTiffAsync(this Image source, Stream stream, TiffEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| TiffEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsTiffAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Tiff format.
Declaration
public static Task SaveAsTiffAsync(this Image source, Stream stream, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsTiffAsync(Image, String)
Saves the image to the given stream with the Tiff format.
Declaration
public static Task SaveAsTiffAsync(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsTiffAsync(Image, String, TiffEncoder, CancellationToken)
Saves the image to the given stream with the Tiff format.
Declaration
public static Task SaveAsTiffAsync(this Image source, string path, TiffEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| TiffEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsTiffAsync(Image, String, CancellationToken)
Saves the image to the given stream with the Tiff format.
Declaration
public static Task SaveAsTiffAsync(this Image source, string path, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsWebp(Image, Stream)
Saves the image to the given stream with the Webp format.
Declaration
public static void SaveAsWebp(this Image source, Stream stream)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsWebp(Image, Stream, WebpEncoder)
Saves the image to the given stream with the Webp format.
Declaration
public static void SaveAsWebp(this Image source, Stream stream, WebpEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| WebpEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsWebp(Image, String)
Saves the image to the given stream with the Webp format.
Declaration
public static void SaveAsWebp(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsWebp(Image, String, WebpEncoder)
Saves the image to the given stream with the Webp format.
Declaration
public static void SaveAsWebp(this Image source, string path, WebpEncoder encoder)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| WebpEncoder | encoder | The encoder to save the image with. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsWebpAsync(Image, Stream, WebpEncoder, CancellationToken)
Saves the image to the given stream with the Webp format.
Declaration
public static Task SaveAsWebpAsync(this Image source, Stream stream, WebpEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| WebpEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsWebpAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Webp format.
Declaration
public static Task SaveAsWebpAsync(this Image source, Stream stream, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| Stream | stream | The stream to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the stream is null. | 
SaveAsWebpAsync(Image, String)
Saves the image to the given stream with the Webp format.
Declaration
public static Task SaveAsWebpAsync(this Image source, string path)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsWebpAsync(Image, String, WebpEncoder, CancellationToken)
Saves the image to the given stream with the Webp format.
Declaration
public static Task SaveAsWebpAsync(this Image source, string path, WebpEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| WebpEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsWebpAsync(Image, String, CancellationToken)
Saves the image to the given stream with the Webp format.
Declaration
public static Task SaveAsWebpAsync(this Image source, string path, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The image this method extends. | 
| String | path | The file path to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Thrown if the path is null. | 
SaveAsync(Image, Stream, IImageFormat, CancellationToken)
Writes the image to the given stream using the given image format.
Declaration
public static Task SaveAsync(this Image source, Stream stream, IImageFormat format, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The source image. | 
| Stream | stream | The stream to save the image to. | 
| IImageFormat | format | The format to save the image in. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The stream is null. | 
| ArgumentNullException | The format is null. | 
| NotSupportedException | The stream is not writable. | 
| NotSupportedException | No encoder available for provided format. | 
SaveAsync(Image, String, IImageEncoder, CancellationToken)
Writes the image to the given file path using the given image encoder.
Declaration
public static async Task SaveAsync(this Image source, string path, IImageEncoder encoder, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The source image. | 
| String | path | The file path to save the image to. | 
| IImageEncoder | encoder | The encoder to save the image with. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The path is null. | 
| ArgumentNullException | The encoder is null. | 
SaveAsync(Image, String, CancellationToken)
Writes the image to the given file path using an encoder detected from the path.
Declaration
public static Task SaveAsync(this Image source, string path, CancellationToken cancellationToken = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The source image. | 
| String | path | The file path to save the image to. | 
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. | 
Returns
| Type | Description | 
|---|---|
| Task | A Task representing the asynchronous operation. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The path is null. | 
| NotSupportedException | No encoder available for provided path. | 
ToBase64String(Image, IImageFormat)
Returns a Base64 encoded string from the given image. The result is prepended with a Data URI https://en.wikipedia.org/wiki/Data_URI_scheme
Declaration
public static string ToBase64String(this Image source, IImageFormat format)Parameters
| Type | Name | Description | 
|---|---|---|
| Image | source | The source image | 
| IImageFormat | format | The format. | 
Returns
| Type | Description | 
|---|---|
| String | The String | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The format is null. |