Alphonse Jose B
Member
- Joined
- Nov 4, 2019
- Messages
- 6
- Programming Experience
- 1-3
VB.NET:Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim bmp1 As Bitmap = Image.FromFile("C:\Temp\ImageCompare\chill.jpg") Dim bmp2 As Bitmap = Image.FromFile("C:\Temp\ImageCompare\chill1.jpg") Dim sameCount As Integer = 0 Dim diffCount As Integer = 0 For x As Integer = 0 To (bmp1.Width) - 1 For y As Integer = 0 To (bmp1.Height) - 1 If bmp1.GetPixel(x, y).Equals(bmp2.GetPixel(x, y)) Then sameCount += 1 Else diffCount += 1 End If Next Next Dim total As Integer = sameCount + diffCount MessageBox.Show(String.Format("Same Percentage: {0}{1}Difference Percentage: {2}", _ (sameCount / total).ToString("p"), Environment.NewLine, (diffCount / total).ToString("p"))) End Sub
While running this code issues in some image.
this is the errror:
parameter must be positive and < height.
Parameter name:y
How to solve this error