You should avoid color.fromargb and color.toargb too as they are slow.
I did the function like this:

VB Code:
  1. Public Function mask2(ByVal iPic As Bitmap) As Bitmap
  2.  
  3.         ' assuming 32 bits per pixel color!!!
  4.  
  5.         Dim NewMask As New Bitmap(iPic.Width, iPic.Height)
  6.         Dim i As New Rectangle
  7.         i.Width = iPic.Width
  8.         i.Height = iPic.Height
  9.  
  10.         Dim sourceData As BitmapData = iPic.LockBits(i, Imaging.ImageLockMode.ReadWrite, iPic.PixelFormat)
  11.         Dim NewData As BitmapData = NewMask.LockBits(i, ImageLockMode.ReadWrite, iPic.PixelFormat)
  12.  
  13.         ' arrays to store the colors
  14.         Dim pixels(i.Width * i.Height - 1) As Integer
  15.         Dim pixels2(i.Width * i.Height - 1) As Integer
  16.  
  17.         ' copy the data
  18.         Marshal.Copy(sourceData.Scan0, pixels, 0, pixels.Length)
  19.  
  20.         Dim index As Integer ' location of pixel(x,y) in pixels array
  21.  
  22.         For y As Integer = 0 To iPic.Height - 1
  23.             For x As Integer = 0 To iPic.Width - 1
  24.                 index = (y * i.Width) + x ' pixels above current row + pixels in current row up to x
  25.                 If pixels(index) = &HFF000000 Then 'black
  26.                     pixels2(index) = &HFFFFFFFF ' white
  27.                 Else
  28.                     pixels2(index) = &HFF000000 ' black
  29.                 End If
  30.             Next
  31.         Next
  32.  
  33.         ' Copy data into bitmapdata
  34.         Marshal.Copy(pixels2, 0, NewData.Scan0, pixels2.Length)
  35.         'unlock
  36.         iPic.UnlockBits(sourceData)
  37.         NewMask.UnlockBits(NewData)
  38.  
  39.         Return NewMask
  40.     End Function

If I change the black from &HFF000000 to color.black.toargb and the white similarly, and time it, then it slows down a bit (~4ms instead of ~2ms for a 100,100 bitmap)

When you need the A, R, G, B values then you need to avoid color.toargb. You can do this by using a byte array instead of an int32 array. Or you can use this to split the values from an int:
VB Code:
  1. alpha = (pixels(i) >> 24) And &HFF
  2.             red = (pixels(i) >> 16) And &HFF
  3.             green = (pixels(i) >> 8) And &HFF
  4.             blue = pixels(i) And &HFF

then you will want to write a color back:
VB Code:
  1. pixels(i) = (255 << 24) _
  2.             Or (grey << 16) _
  3.             Or (grey << 8) _
  4.             Or grey