ImageExtensionsEqualsByContent Method

Compares an image to another one by content and returns whether they are equal. Images of different size or pixel format are considered different.

Definition

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 8.1.0
C#
public static bool EqualsByContent(
	this Image? image1,
	Image? image2
)

Parameters

image1  Image
First image instance.
image2  Image
Second image instance.

Return Value

Boolean
if both images have the same content; otherwise, .

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Image. 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 an image is not a Bitmap instance, a temporary Bitmap is created for the check.

  Note

This method compares images by raw content. If the images have padding in each stride (content row), padding content is considered as well.

See Also