Hi,
I need a very fast method to detect if an image is empty. Im my case then all pixels are white and transparant. The images are png's. My current method is to load them in a memory bitmap and check each pixel value, but this is way to slow. Is there a more efficient way?
This is my current code:
'Lock the bitmap bits.
Dim bmpData As System.Drawing.Imaging.BitmapData = bmp.LockBits(rectBmp, _
Drawing.Imaging.ImageLockMode.ReadOnly, bmp.PixelFormat)
Try
Dim x As Integer
Dim y As Integer
For y = 0 To bmpData.Height - 1
For x = 0 To bmpData.Width - 1
If System.Runtime.InteropServices.Marshal.ReadByte(bmpData.Scan0, (bmpData.Stride * y) + (4 * x) + 3) <> 0 Then
Return True
Exit For
End If
Next
Next
Finally
bmp.UnlockBits(bmpData)
End Try