re: Image overwrite
Hi,
Ive just written this code for the same functionality. The catch is that it does not preserve metadata like exif headers.
public static void ResizeImageFile(string path, int width, int height)
{
Image in_img = Image.FromFile(path);
Image out_img = ResizeImage(in_img,width,height);
in_img.Dispose();
System.IO.File.Delete(path);
out_img.Save(path ,ImageFormat.Jpeg);
}
public static Image ResizeImage(Image img, int width, int height)
{
Bitmap b;
Image i;
Graphics g ;
b = new Bitmap(width, height); i = Image.FromHbitmap(b.GetHbitmap());
g = Graphics.FromImage(i);
g.DrawImage(img,0f,0f,width, height);
g.Dispose();
img.Dispose();
return i;
}
regards, Guido