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 a
The pnmcrop utility from the netpbm graphics utilities library does exactly that.
pnmcrop
netpbm
I suggest looking at their code, available from http://netpbm.sourceforge.net/