Platforms to show: All Mac Windows Linux Cross-Platform

Back to Picture class.

Picture.CompareMBS(other as picture, threshold as Integer) as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 10.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compares two pictures.
Example
dim p as picture = New Picture(100,100,32)
dim q as Picture = New Picture(100,100,32)

dim diff as Double = p.CompareMBS(q, 0)

MsgBox str(Diff) // shows 0 = equal

p.Graphics.ForeColor = &cFF0000
p.Graphics.FillRect 0, 0, p.Width, p.Height

q.Graphics.ForeColor = &cFF0001
q.Graphics.FillRect 0, 0, q.Width, q.Height

dim diff1 as Double = p.CompareMBS(q, 0)
dim diff2 as Double = p.CompareMBS(q, 2)

MsgBox str(Diff1)+" "+str(Diff2) // shows 1 (all pixels different) and shows 0 (all equal)

Returns the percent of difference: Number of pixels where the squared color difference is bigger than the threshold divided by the total number of pixels.
If width and height are not equal, the result is 1.0.
If you need to check the mask also, please call this method a second time for the masks.

Only compares raw pixels without checking mask or alpha channel.

The items on this page are in the following plugins: MBS Picture Plugin.


The biggest plugin in space...