Hello,
This is to find the first darkest pixel, in order to crop a image, but it's too slow.
Is there a way to speed this?
Thanks
This is to find the first darkest pixel, in order to crop a image, but it's too slow.
Is there a way to speed this?
PHP:
Dim bmp As Bitmap = im
Dim wth As Integer = 0
Dim hgh As Integer = 0
Dim newpoint As Drawing.Point
Dim aL As Integer = 0
Dim aC As Integer = 0
'FROM SIDE
For wth = 0 To bmp.Width - 1
newpoint.X = wth
For hgh = 0 To bmp.Height - 1
newpoint.Y = hgh
Dim mycolor As Color = DirectCast(bmp, Bitmap).GetPixel(newpoint.X, newpoint.Y)
If (mycolor.B.ToString < 100) Then
aL = wth
Exit For
End If
Next
If (aL <> 0) Then
Exit For
End If
Next
'FROM TOP
For hgh = 0 To bmp.Height - 1
newpoint.Y = hgh
For wth = 0 To bmp.Width - 1
newpoint.X = wth
Dim mycolor As Color = DirectCast(bmp, Bitmap).GetPixel(newpoint.X, newpoint.Y)
If (mycolor.B.ToString < 100) Then
aC = hgh
Exit For
End If
Next
If (aC <> 0) Then
Exit For
End If
Next
Thanks