Updated - see new post here.
A little while back I ran into a couple situations (desktop: batch image resampling & web: facebook) that involved some basic image manipulation, so I threw together a quick dll to handle it for me. Also, I've found that we've gotten quite a few copies of Photoshop being used for little more than cropping & resampling.
For anyone that could use such things, simply grab this zip, add a reference to the dll, and go to town. Inside the zip, you'll find the source project & and a winforms demo app project that uses each of the methods.
[.Net Image Cropper/Resampler]
The interface to the ImageManipulator class is below.
public interface IImageManipulator{
void LoadNewImage(Bitmap Image);
Bitmap ResampleTo(int Width, int Height);
Bitmap ResampleToWidth(int Width, bool KeepAspectRatio);
Bitmap ResampleToHeight(int Height, bool KeepAspectRatio);
Bitmap CropFromTop(int PixelsFromTop);
Bitmap CropFromBottom(int PixelsFromBottom);
Bitmap CropFromRight(int PixelsFromRight);
Bitmap CropFromLeft(int PixelsFromLeft);
void Undo();
void Redo();
Bitmap Current{get;set;}
int HistoryCount{get;}
}
Print | posted on Monday, February 06, 2006 9:38 PM