<p>I have a block of product images we received from a customer.  Each product image is a picture of something and it was taken with a white background.  I would like to crop all the surrounding parts of the image but leave only the product in the middle.  Is this possible?</p>

<p>As an example: [<a href="http://www.5dnet.de/media/catalog/product/d/r/dress_shoes_5.jpg][1]" rel="noreferrer">http://www.5dnet.de/media/catalog/product/d/r/dress_shoes_5.jpg][1]</a></p>

<p>I don't want all white pixels removed, however I do want the image cropped so that the top-most row of pixels contains one non-white pixel, the left-most vertical row of pixels contains one non-white pixel, bottom-most horizontal row of pixels contains one non-white pixel, etc.</p>

<p>Code in C# or VB.net would be appreciated.</p>

I've written code to do this myself - it's not too difficult to get the basics going.
Essentially, you need to scan pixel rows/columns to check for non-white pixels and isolate the bounds of the product image, then create a new bitmap with just that region.
Note that while the
```
Bitmap.GetPixel()
```
method works, it's relatively slow. If processing time is important, you'll need to use
```
Bitmap.LockBits()
```
to lock the bitmap in memory, and then some simple pointer use inside an
```
unsafe { }
```
block to access the pixels directly.
This article
on CodeProject gives some more details that you'll probably find useful.