ImageExtensions Class

Provides extension methods for the Image type.

Definition

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 7.0.0
C#
public static class ImageExtensions
Inheritance
Object    ImageExtensions

Methods

BeginConvertPixelFormat(Image, PixelFormat, IQuantizer, IDitherer, AsyncConfig) Begins to convert the specified image to a Bitmap of the desired PixelFormat asynchronously.
BeginConvertPixelFormat(Image, PixelFormat, Color, Byte, AsyncConfig) Begins to convert the specified image to a Bitmap of the desired PixelFormat asynchronously.
BeginConvertPixelFormat(Image, PixelFormat, Color, Color, Byte, AsyncConfig) Begins to convert the specified image to a Bitmap of the desired PixelFormat asynchronously.
ConvertPixelFormat(Image, PixelFormat, IQuantizer, IDitherer) Converts the specified image to a Bitmap with the desired PixelFormat.
ConvertPixelFormat(Image, PixelFormat, Color, Byte) Converts the specified image to a Bitmap of the desired PixelFormat.
ConvertPixelFormat(Image, PixelFormat, Color, Color, Byte) Converts the specified image to a Bitmap of the desired PixelFormat.
ConvertPixelFormatAsync(Image, PixelFormat, IQuantizer, IDitherer, TaskConfig) Converts the specified image to a Bitmap of the desired PixelFormat asynchronously.
ConvertPixelFormatAsync(Image, PixelFormat, Color, Byte, TaskConfig) Converts the specified image to a Bitmap of the desired PixelFormat asynchronously.
ConvertPixelFormatAsync(Image, PixelFormat, Color, Color, Byte, TaskConfig) Converts the specified image to a Bitmap of the desired PixelFormat asynchronously.
DrawInto(Image, Bitmap, Point, IDitherer) Draws the source Image into the target Bitmap without scaling. This method is similar to Graphics.DrawImage methods, except that this one always preserves the source size in pixels, works between any pair of source and target PixelFormats and supports quantizing and dithering. For scaling use the overloads with targetRectangle and ScalingMode parameters.
DrawInto(Image, Bitmap, Rectangle, ScalingMode) Draws the source Image into the target Bitmap with possible scaling. This method is similar to Graphics.DrawImage methods, except that this one works between any pair of source and target PixelFormats and supports quantizing.
DrawInto(Image, Bitmap, Point, IQuantizer, IDitherer) Draws the source Image into the target Bitmap without scaling. This method is similar to Graphics.DrawImage methods, except that this one always preserves the source size in pixels, works between any pair of source and target PixelFormats and supports quantizing and dithering. For scaling use the overloads with targetRectangle and ScalingMode parameters.
DrawInto(Image, Bitmap, Rectangle, IDitherer, ScalingMode) Draws the source Image into the target Bitmap with possible scaling. This method is similar to Graphics.DrawImage methods, except that this one works between any pair of source and target PixelFormats and supports quantizing and dithering.
DrawInto(Image, Bitmap, Rectangle, Point, IDitherer) Draws the source Image into the target Bitmap without scaling. This method is similar to Graphics.DrawImage methods, except that this one always preserves the source size in pixels, works between any pair of source and target PixelFormats and supports quantizing and dithering. For scaling use the overloads with targetRectangle and ScalingMode parameters.
DrawInto(Image, Bitmap, Rectangle, Rectangle, ScalingMode) Draws the source Image into the target Bitmap with possible scaling. This method is similar to Graphics.DrawImage methods, except that this one works between any pair of source and target PixelFormats and supports quantizing.
DrawInto(Image, Bitmap, Rectangle, IQuantizer, IDitherer, ScalingMode) Draws the source Image into the target Bitmap with possible scaling. This method is similar to Graphics.DrawImage methods, except that this one works between any pair of source and target PixelFormats and supports quantizing and dithering.
DrawInto(Image, Bitmap, Rectangle, Point, IQuantizer, IDitherer) Draws the source Image into the target Bitmap without scaling. This method is similar to Graphics.DrawImage methods, except that this one always preserves the source size in pixels, works between any pair of source and target PixelFormats and supports quantizing and dithering. For scaling use the overloads with targetRectangle and ScalingMode parameters.
DrawInto(Image, Bitmap, Rectangle, Rectangle, IDitherer, ScalingMode) Draws the source Image into the target Bitmap with possible scaling. This method is similar to Graphics.DrawImage methods, except that this one works between any pair of source and target PixelFormats and supports quantizing and dithering.
DrawInto(Image, Bitmap, Rectangle, Rectangle, IQuantizer, IDitherer, ScalingMode) Draws the source Image into the target Bitmap with possible scaling. This method is similar to Graphics.DrawImage methods, except that this one works between any pair of source and target PixelFormats and supports quantizing and dithering.
EndConvertPixelFormat Waits for the pending asynchronous operation started by the BeginConvertPixelFormat methods to complete. In .NET Framework 4.0 and above you can use the ConvertPixelFormatAsync methods instead.
EqualsByContent Compares an image to another one by content and returns whether they are equal. Images of different size or pixel format are considered different.
GetBitsPerPixel Gets the bits per pixel (BPP) value of the image.
SaveAsAnimatedGif(IEnumerableImage, Stream, IEnumerableTimeSpan, IQuantizer, IDitherer) Saves the provided frames as a looping GIF animation into the specified Stream. When Image instances in frames contain already multiple frames, only the current frame is taken.
SaveAsAnimatedGif(IEnumerableImage, Stream, NullableTimeSpan, IQuantizer, IDitherer) Saves the provided frames as a looping GIF animation into the specified Stream. When Image instances in frames contain already multiple frames, only the current frame is taken.
See the Remarks section of the SaveAsAnimatedGif(IEnumerableImage, Stream, IEnumerableTimeSpan, IQuantizer, IDitherer) for details.
SaveAsAnimatedGif(IEnumerableImage, String, IEnumerableTimeSpan, IQuantizer, IDitherer) Saves the provided frames as a looping GIF animation into the specified file. When Image instances in frames contain already multiple frames, only the current frame is taken.
See the Remarks section of the SaveAsAnimatedGif(IEnumerableImage, Stream, IEnumerableTimeSpan, IQuantizer, IDitherer) overload for details.
SaveAsAnimatedGif(IEnumerableImage, String, NullableTimeSpan, IQuantizer, IDitherer) Saves the provided frames as a looping GIF animation into the specified file. When Image instances in frames contain already multiple frames, only the current frame is taken.
See the Remarks section of the SaveAsAnimatedGif(IEnumerableImage, Stream, IEnumerableTimeSpan, IQuantizer, IDitherer) overload for details.
SaveAsBmp(Image, Stream) Saves the specified image into a stream using the built-in BMP encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
SaveAsBmp(Image, String) Saves the specified image to the specified file using the built-in BMP encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
See the Remarks section of the SaveAsBmp(Image, Stream) overload for details and an example.
SaveAsGif(Image, Stream, Boolean) Saves the specified image as a GIF image.
Obsolete.
SaveAsGif(Image, Stream, Color) Saves the specified image as a GIF image.
Obsolete.
SaveAsGif(Image, Stream, IQuantizer, IDitherer) Saves the specified image using the built-in GIF encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
SaveAsGif(Image, String, IQuantizer, IDitherer) Saves the specified image to the specified file using the built-in GIF encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
See the Remarks section of the SaveAsGif(Image, Stream, IQuantizer, IDitherer) overload for details.
SaveAsHighColorGif(Image, Stream, Boolean, Color, Byte) Encodes the specified image as a multi-layered, single frame GIF image and writes it into the specified stream, preserving its original color depth.
SaveAsHighColorGif(Image, String, Boolean, Color, Byte) Encodes the specified image as a multi-layered, single frame GIF image and writes it into the specified file, preserving its original color depth.
See the Remarks section of the SaveAsHighColorGif(Image, Stream, Boolean, Color, Byte) overload for details.
SaveAsIcon(IEnumerableImage, Stream, Boolean) Saves the specified images as an Icon without relying on a built-in encoder in the operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat and does not save a PNG stream when no built-in Icon encoder can be found in the operating system.
SaveAsIcon(Image, Stream, Boolean) Saves the specified image as an Icon without relying on a built-in encoder in the operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat and does not save a PNG stream when no built-in Icon encoder can be found in the operating system.
SaveAsIcon(Image, String, Boolean) Saves the specified image as an Icon without relying on a built-in encoder in the operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat and does not save a PNG stream when no built-in Icon encoder can be found in the operating system.
See the Remarks section of the SaveAsIcon(Image, Stream, Boolean) overload for details.
SaveAsJpeg(Image, Stream, Int32) Saves the specified image using the built-in JPEG encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
SaveAsJpeg(Image, String, Int32) Saves the specified image to the specified file using the built-in JPEG encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
See the Remarks section of the SaveAsJpeg(Image, Stream, Int32) overload for details and an example.
SaveAsMultipageTiff(IEnumerableImage, Stream) Saves the provided images as a multi-page TIFF into the specified Stream. When Image instances in images contain already multiple pages, only the current page is taken.
SaveAsMultipageTiff(IEnumerableImage, String) Saves the provided images as a multi-page TIFF into the specified Stream. When Image instances in images contain already multiple pages, only the current page is taken.
See the Remarks section of the SaveAsMultipageTiff(IEnumerableImage, Stream) overload for details.
SaveAsPng(Image, Stream) Saves the specified image using the built-in PNG encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
SaveAsPng(Image, String) Saves the specified image to the specified file using the built-in PNG encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
See the Remarks section of the SaveAsPng(Image, Stream) overload for details.
SaveAsTiff(Image, Stream, Boolean) Saves the specified image using the built-in TIFF encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
SaveAsTiff(Image, String, Boolean) Saves the specified image to the specified file using the built-in TIFF encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
See the Remarks section of the SaveAsTiff(Image, Stream, Boolean) overload for details.
ToGrayscale Returns a new Image, which is the grayscale version of the specified image.
ToIcon(Image, Color) Creates an Icon from an Image.
ToIcon(Image, Int32, Boolean) Creates an Icon from an Image.
ToIcon(Image, Int32, ScalingMode, Boolean) Creates an Icon from an Image.

See Also