Class ImageExtensions
- Namespace
- SixLabors.ImageSharp
- Assembly
- SixLabors.ImageSharp.dll
Extension methods for the Image type.
public static class ImageExtensions
- Inheritance
-
ImageExtensions
- Inherited Members
Methods
Save(Image, Stream, IImageFormat)
Writes the image to the given stream using the given image format.
public static void Save(this Image source, Stream stream, IImageFormat format)
Parameters
sourceImageThe source image.
streamStreamThe stream to save the image to.
formatIImageFormatThe format to save the image in.
Exceptions
- 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.
public static void Save(this Image source, string path)
Parameters
Exceptions
- 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.
public static void Save(this Image source, string path, IImageEncoder encoder)
Parameters
sourceImageThe source image.
pathstringThe file path to save the image to.
encoderIImageEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
The path is null.
- ArgumentNullException
The encoder is null.
SaveAsBmp(Image, Stream)
Saves the image to the given stream with the Bmp format.
public static void SaveAsBmp(this Image source, Stream stream)
Parameters
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsBmp(Image, Stream, BmpEncoder)
Saves the image to the given stream with the Bmp format.
public static void SaveAsBmp(this Image source, Stream stream, BmpEncoder encoder)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderBmpEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsBmp(Image, string)
Saves the image to the given stream with the Bmp format.
public static void SaveAsBmp(this Image source, string path)
Parameters
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsBmp(Image, string, BmpEncoder)
Saves the image to the given stream with the Bmp format.
public static void SaveAsBmp(this Image source, string path, BmpEncoder encoder)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderBmpEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsBmpAsync(Image, Stream, BmpEncoder, CancellationToken)
Saves the image to the given stream with the Bmp format.
public static Task SaveAsBmpAsync(this Image source, Stream stream, BmpEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderBmpEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsBmpAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Bmp format.
public static Task SaveAsBmpAsync(this Image source, Stream stream, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsBmpAsync(Image, string)
Saves the image to the given stream with the Bmp format.
public static Task SaveAsBmpAsync(this Image source, string path)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsBmpAsync(Image, string, BmpEncoder, CancellationToken)
Saves the image to the given stream with the Bmp format.
public static Task SaveAsBmpAsync(this Image source, string path, BmpEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderBmpEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsBmpAsync(Image, string, CancellationToken)
Saves the image to the given stream with the Bmp format.
public static Task SaveAsBmpAsync(this Image source, string path, CancellationToken cancellationToken)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsGif(Image, Stream)
Saves the image to the given stream with the Gif format.
public static void SaveAsGif(this Image source, Stream stream)
Parameters
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsGif(Image, Stream, GifEncoder)
Saves the image to the given stream with the Gif format.
public static void SaveAsGif(this Image source, Stream stream, GifEncoder encoder)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderGifEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsGif(Image, string)
Saves the image to the given stream with the Gif format.
public static void SaveAsGif(this Image source, string path)
Parameters
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsGif(Image, string, GifEncoder)
Saves the image to the given stream with the Gif format.
public static void SaveAsGif(this Image source, string path, GifEncoder encoder)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderGifEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsGifAsync(Image, Stream, GifEncoder, CancellationToken)
Saves the image to the given stream with the Gif format.
public static Task SaveAsGifAsync(this Image source, Stream stream, GifEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderGifEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsGifAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Gif format.
public static Task SaveAsGifAsync(this Image source, Stream stream, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsGifAsync(Image, string)
Saves the image to the given stream with the Gif format.
public static Task SaveAsGifAsync(this Image source, string path)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsGifAsync(Image, string, GifEncoder, CancellationToken)
Saves the image to the given stream with the Gif format.
public static Task SaveAsGifAsync(this Image source, string path, GifEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderGifEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsGifAsync(Image, string, CancellationToken)
Saves the image to the given stream with the Gif format.
public static Task SaveAsGifAsync(this Image source, string path, CancellationToken cancellationToken)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsJpeg(Image, Stream)
Saves the image to the given stream with the Jpeg format.
public static void SaveAsJpeg(this Image source, Stream stream)
Parameters
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsJpeg(Image, Stream, JpegEncoder)
Saves the image to the given stream with the Jpeg format.
public static void SaveAsJpeg(this Image source, Stream stream, JpegEncoder encoder)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderJpegEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsJpeg(Image, string)
Saves the image to the given stream with the Jpeg format.
public static void SaveAsJpeg(this Image source, string path)
Parameters
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsJpeg(Image, string, JpegEncoder)
Saves the image to the given stream with the Jpeg format.
public static void SaveAsJpeg(this Image source, string path, JpegEncoder encoder)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderJpegEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsJpegAsync(Image, Stream, JpegEncoder, CancellationToken)
Saves the image to the given stream with the Jpeg format.
public static Task SaveAsJpegAsync(this Image source, Stream stream, JpegEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderJpegEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsJpegAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Jpeg format.
public static Task SaveAsJpegAsync(this Image source, Stream stream, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsJpegAsync(Image, string)
Saves the image to the given stream with the Jpeg format.
public static Task SaveAsJpegAsync(this Image source, string path)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsJpegAsync(Image, string, JpegEncoder, CancellationToken)
Saves the image to the given stream with the Jpeg format.
public static Task SaveAsJpegAsync(this Image source, string path, JpegEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderJpegEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsJpegAsync(Image, string, CancellationToken)
Saves the image to the given stream with the Jpeg format.
public static Task SaveAsJpegAsync(this Image source, string path, CancellationToken cancellationToken)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsPbm(Image, Stream)
Saves the image to the given stream with the Pbm format.
public static void SaveAsPbm(this Image source, Stream stream)
Parameters
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsPbm(Image, Stream, PbmEncoder)
Saves the image to the given stream with the Pbm format.
public static void SaveAsPbm(this Image source, Stream stream, PbmEncoder encoder)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderPbmEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsPbm(Image, string)
Saves the image to the given stream with the Pbm format.
public static void SaveAsPbm(this Image source, string path)
Parameters
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsPbm(Image, string, PbmEncoder)
Saves the image to the given stream with the Pbm format.
public static void SaveAsPbm(this Image source, string path, PbmEncoder encoder)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderPbmEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsPbmAsync(Image, Stream, PbmEncoder, CancellationToken)
Saves the image to the given stream with the Pbm format.
public static Task SaveAsPbmAsync(this Image source, Stream stream, PbmEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderPbmEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsPbmAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Pbm format.
public static Task SaveAsPbmAsync(this Image source, Stream stream, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsPbmAsync(Image, string)
Saves the image to the given stream with the Pbm format.
public static Task SaveAsPbmAsync(this Image source, string path)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsPbmAsync(Image, string, PbmEncoder, CancellationToken)
Saves the image to the given stream with the Pbm format.
public static Task SaveAsPbmAsync(this Image source, string path, PbmEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderPbmEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsPbmAsync(Image, string, CancellationToken)
Saves the image to the given stream with the Pbm format.
public static Task SaveAsPbmAsync(this Image source, string path, CancellationToken cancellationToken)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsPng(Image, Stream)
Saves the image to the given stream with the Png format.
public static void SaveAsPng(this Image source, Stream stream)
Parameters
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsPng(Image, Stream, PngEncoder)
Saves the image to the given stream with the Png format.
public static void SaveAsPng(this Image source, Stream stream, PngEncoder encoder)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderPngEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsPng(Image, string)
Saves the image to the given stream with the Png format.
public static void SaveAsPng(this Image source, string path)
Parameters
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsPng(Image, string, PngEncoder)
Saves the image to the given stream with the Png format.
public static void SaveAsPng(this Image source, string path, PngEncoder encoder)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderPngEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsPngAsync(Image, Stream, PngEncoder, CancellationToken)
Saves the image to the given stream with the Png format.
public static Task SaveAsPngAsync(this Image source, Stream stream, PngEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderPngEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsPngAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Png format.
public static Task SaveAsPngAsync(this Image source, Stream stream, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsPngAsync(Image, string)
Saves the image to the given stream with the Png format.
public static Task SaveAsPngAsync(this Image source, string path)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsPngAsync(Image, string, PngEncoder, CancellationToken)
Saves the image to the given stream with the Png format.
public static Task SaveAsPngAsync(this Image source, string path, PngEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderPngEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsPngAsync(Image, string, CancellationToken)
Saves the image to the given stream with the Png format.
public static Task SaveAsPngAsync(this Image source, string path, CancellationToken cancellationToken)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsQoi(Image, Stream)
Saves the image to the given stream with the Qoi format.
public static void SaveAsQoi(this Image source, Stream stream)
Parameters
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsQoi(Image, Stream, QoiEncoder)
Saves the image to the given stream with the Qoi format.
public static void SaveAsQoi(this Image source, Stream stream, QoiEncoder encoder)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderQoiEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsQoi(Image, string)
Saves the image to the given stream with the Qoi format.
public static void SaveAsQoi(this Image source, string path)
Parameters
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsQoi(Image, string, QoiEncoder)
Saves the image to the given stream with the Qoi format.
public static void SaveAsQoi(this Image source, string path, QoiEncoder encoder)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderQoiEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsQoiAsync(Image, Stream, QoiEncoder, CancellationToken)
Saves the image to the given stream with the Qoi format.
public static Task SaveAsQoiAsync(this Image source, Stream stream, QoiEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderQoiEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsQoiAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Qoi format.
public static Task SaveAsQoiAsync(this Image source, Stream stream, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsQoiAsync(Image, string)
Saves the image to the given stream with the Qoi format.
public static Task SaveAsQoiAsync(this Image source, string path)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsQoiAsync(Image, string, QoiEncoder, CancellationToken)
Saves the image to the given stream with the Qoi format.
public static Task SaveAsQoiAsync(this Image source, string path, QoiEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderQoiEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsQoiAsync(Image, string, CancellationToken)
Saves the image to the given stream with the Qoi format.
public static Task SaveAsQoiAsync(this Image source, string path, CancellationToken cancellationToken)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsTga(Image, Stream)
Saves the image to the given stream with the Tga format.
public static void SaveAsTga(this Image source, Stream stream)
Parameters
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsTga(Image, Stream, TgaEncoder)
Saves the image to the given stream with the Tga format.
public static void SaveAsTga(this Image source, Stream stream, TgaEncoder encoder)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderTgaEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsTga(Image, string)
Saves the image to the given stream with the Tga format.
public static void SaveAsTga(this Image source, string path)
Parameters
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsTga(Image, string, TgaEncoder)
Saves the image to the given stream with the Tga format.
public static void SaveAsTga(this Image source, string path, TgaEncoder encoder)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderTgaEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsTgaAsync(Image, Stream, TgaEncoder, CancellationToken)
Saves the image to the given stream with the Tga format.
public static Task SaveAsTgaAsync(this Image source, Stream stream, TgaEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderTgaEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsTgaAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Tga format.
public static Task SaveAsTgaAsync(this Image source, Stream stream, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsTgaAsync(Image, string)
Saves the image to the given stream with the Tga format.
public static Task SaveAsTgaAsync(this Image source, string path)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsTgaAsync(Image, string, TgaEncoder, CancellationToken)
Saves the image to the given stream with the Tga format.
public static Task SaveAsTgaAsync(this Image source, string path, TgaEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderTgaEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsTgaAsync(Image, string, CancellationToken)
Saves the image to the given stream with the Tga format.
public static Task SaveAsTgaAsync(this Image source, string path, CancellationToken cancellationToken)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsTiff(Image, Stream)
Saves the image to the given stream with the Tiff format.
public static void SaveAsTiff(this Image source, Stream stream)
Parameters
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsTiff(Image, Stream, TiffEncoder)
Saves the image to the given stream with the Tiff format.
public static void SaveAsTiff(this Image source, Stream stream, TiffEncoder encoder)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderTiffEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsTiff(Image, string)
Saves the image to the given stream with the Tiff format.
public static void SaveAsTiff(this Image source, string path)
Parameters
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsTiff(Image, string, TiffEncoder)
Saves the image to the given stream with the Tiff format.
public static void SaveAsTiff(this Image source, string path, TiffEncoder encoder)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderTiffEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsTiffAsync(Image, Stream, TiffEncoder, CancellationToken)
Saves the image to the given stream with the Tiff format.
public static Task SaveAsTiffAsync(this Image source, Stream stream, TiffEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderTiffEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsTiffAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Tiff format.
public static Task SaveAsTiffAsync(this Image source, Stream stream, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsTiffAsync(Image, string)
Saves the image to the given stream with the Tiff format.
public static Task SaveAsTiffAsync(this Image source, string path)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsTiffAsync(Image, string, TiffEncoder, CancellationToken)
Saves the image to the given stream with the Tiff format.
public static Task SaveAsTiffAsync(this Image source, string path, TiffEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderTiffEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsTiffAsync(Image, string, CancellationToken)
Saves the image to the given stream with the Tiff format.
public static Task SaveAsTiffAsync(this Image source, string path, CancellationToken cancellationToken)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsWebp(Image, Stream)
Saves the image to the given stream with the Webp format.
public static void SaveAsWebp(this Image source, Stream stream)
Parameters
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsWebp(Image, Stream, WebpEncoder)
Saves the image to the given stream with the Webp format.
public static void SaveAsWebp(this Image source, Stream stream, WebpEncoder encoder)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderWebpEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsWebp(Image, string)
Saves the image to the given stream with the Webp format.
public static void SaveAsWebp(this Image source, string path)
Parameters
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsWebp(Image, string, WebpEncoder)
Saves the image to the given stream with the Webp format.
public static void SaveAsWebp(this Image source, string path, WebpEncoder encoder)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderWebpEncoderThe encoder to save the image with.
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsWebpAsync(Image, Stream, WebpEncoder, CancellationToken)
Saves the image to the given stream with the Webp format.
public static Task SaveAsWebpAsync(this Image source, Stream stream, WebpEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
encoderWebpEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsWebpAsync(Image, Stream, CancellationToken)
Saves the image to the given stream with the Webp format.
public static Task SaveAsWebpAsync(this Image source, Stream stream, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
streamStreamThe stream to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the stream is null.
SaveAsWebpAsync(Image, string)
Saves the image to the given stream with the Webp format.
public static Task SaveAsWebpAsync(this Image source, string path)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsWebpAsync(Image, string, WebpEncoder, CancellationToken)
Saves the image to the given stream with the Webp format.
public static Task SaveAsWebpAsync(this Image source, string path, WebpEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
encoderWebpEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsWebpAsync(Image, string, CancellationToken)
Saves the image to the given stream with the Webp format.
public static Task SaveAsWebpAsync(this Image source, string path, CancellationToken cancellationToken)
Parameters
sourceImageThe image this method extends.
pathstringThe file path to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown if the path is null.
SaveAsync(Image, Stream, IImageFormat, CancellationToken)
Writes the image to the given stream using the given image format.
public static Task SaveAsync(this Image source, Stream stream, IImageFormat format, CancellationToken cancellationToken = default)
Parameters
sourceImageThe source image.
streamStreamThe stream to save the image to.
formatIImageFormatThe format to save the image in.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- 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.
public static Task SaveAsync(this Image source, string path, IImageEncoder encoder, CancellationToken cancellationToken = default)
Parameters
sourceImageThe source image.
pathstringThe file path to save the image to.
encoderIImageEncoderThe encoder to save the image with.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- 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.
public static Task SaveAsync(this Image source, string path, CancellationToken cancellationToken = default)
Parameters
sourceImageThe source image.
pathstringThe file path to save the image to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- 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
public static string ToBase64String(this Image source, IImageFormat format)
Parameters
sourceImageThe source image
formatIImageFormatThe format.
Returns
Exceptions
- ArgumentNullException
The format is null.