Equal pictures
Equal pictures ( picture1 ; picture2 ; mask ) : Boolean
Parameter | Type | Description | |
---|---|---|---|
picture1 | Picture, Picture | → | Original source picture |
picture2 | Picture, Picture | → | Picture to compare |
mask | Picture, Picture | ← | Resulting mask |
Function result | Boolean | ← | True if both pictures are identical; otherwise, False |
Description
The Equal pictures command precisely compares both the dimensions and the contents of two pictures.
Pass the source picture in picture1 and the picture you want to compare with it in picture2.
- If the pictures are not the same dimension, the command returns False and the mask parameter contains a blank picture.
- If the pictures are of the same dimension but with different contents, the command returns False and the mask parameter contains the resulting picture mask based on a comparison of the two pictures. This comparison is performed pixel by pixel, and each pixel that does not match appears white on a black background.
- If both pictures are exactly the same, the command returns True and the mask parameter contains a picture that is completely black.
System variables and sets
If the command is executed successfully (the two pictures are compared), the system variable OK is set to 1. In the case of an anomaly, particularly if one of the pictures is not initialized (blank picture), the OK variable is set to 0.
Example
In the following example, we compare two pictures (pict1 and pict2) and display the resulting mask:
Here is the code for the Compare button:
$equal :=Equal pictures($pict1;$pict2;$mask)
Properties
Command number | 1196 |
Thread safe | ✓ |
Modifies variables | OK |