IconExtensionsResize(Icon, Size, ScalingMode) Method

Resizes the specified Icon instance to the specified size using the specified scalingMode.

Definition

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 10.0.0-rc.1
C#
public static Icon Resize(
	this Icon icon,
	Size size,
	ScalingMode scalingMode
)

Parameters

icon  Icon
The icon to resize.
size  Size
The required size of the result.
scalingMode  ScalingMode
A ScalingMode value, which determines the quality of the result as well as the processing time.

Return Value

Icon
An Icon instance that contains exactly one image with the specified size.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Icon. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

If the icon contains images with the specified size, then this method just extracts the highest bit-per-pixel image of the requested size.

If the icon does not contain an image exactly with the specified size, then this method takes a close image in size and resizes that to the requested size. If resizing happens, the result will always contain a 32 bpp image.

  Note

This method adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation or reporting progress. Use the BitmapDataExtensions.BeginResize or BitmapDataExtensions.ResizeAsync (in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.

This method always performs resizing in the linear color space. It helps preserve the original brightness, especially for low color depth icons.

See Also