Option Explicit
Private Type Picture_Type
Size As Long
Width As Long
Height As Long
End Type
Private Sub Command1_Click()
Dim Pic(1) As Picture_Type
Dim X As Long, Y As Long
Dim Is_The_Same As Long
Dim Comparison As Single
With Picture1
.BorderStyle = False
.Picture = LoadPicture("C:\Jacob's Stuff\Pics\Alice.jpg")
.AutoSize = True
.AutoRedraw = True
.ScaleMode = 3
End With
With Picture2
.BorderStyle = False
.Picture = LoadPicture("C:\Jacob's Stuff\Pics\whiterabbit.jpg")
.AutoSize = True
.AutoRedraw = True
.ScaleMode = 3
End With
With Pic(0)
.Size = Picture1.ScaleWidth * Picture1.ScaleHeight
.Width = Picture1.ScaleWidth
.Height = Picture1.ScaleHeight
End With
With Pic(1)
.Size = Picture2.ScaleWidth * Picture1.ScaleHeight
.Width = Picture2.ScaleWidth
.Height = Picture2.ScaleHeight
End With
If Pic(0).Size = Pic(1).Size Then
For Y = 0 To Pic(0).Height - 1
For X = 0 To Pic(0).Width - 1
If Picture1.Point(X, Y) = Picture2.Point(X, Y) Then
Is_The_Same = Is_The_Same + 1
End If
Next X
Next Y
Comparison = (Is_The_Same / Pic(0).Size) * 100
MsgBox "Both images are " & Comparison & "% the same", vbInformation
Else
MsgBox "The pictures are not the same size, so no comparison will be made.", vbCritical
End If