KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using the Equal pictures command
PRODUCT: 4D | VERSION: 16 | PLATFORM: Mac & Win
Published On: April 23, 2018

The 4D command Equal pictures can be used to precicely compare two pictures, returning a mask picture with the difference and a boolean. If the pictures are compared and found to be identical, the boolean value will be True, otherwise it will be False.

It may seem then, if comparing two blank pictures, that the command would return True since two blank pictures would seem to be identical logically, however this is not the case.

A careful reading of the documentation for this command will explain why: If the command encounters an anomaly, particularly if one of the pictures is not initialized (blank) then the OK variable is set to 0, meaning the command did not execute successfully.

Considering the command did not execute successfully, the pictures cannot be compared, and the command returns False. Remember, the only way this command returns True is if the pictures are compared and found to be identical.

Checking the OK variable after this command is a good idea to make sure the command executed successfully, otherwise the boolean result you get False may not be because the pictures are different, but because there was an issue (such as the case of the blank picutres). The only way to be sure the command has executed successfully WITHOUT checking the OK variable is if the command returns True, so it is advised to utilize the OK variable along with this command when developing with the Equal pictures command.