In code, I retrieve a bitmap that has been drawn with on a picturebox by the user. This drawing is a white background with black pen, and can be of any size within the bounds of the picturebox. What I need to do first is remove all the excess whitespace around the bitmap. The way I have been doing this has been to run an iteration through every pixel of the bitmap, looking for black, and recording these co-ordinates. With the bitmap being at least 300 x 120 pixels this iteration takes time, around 6 minutes on this PC. I need:
A) a more efficient way to find the useful part of the image on the bitmap.
B) a way to move this part of the image to a new bitmap