User672738083 posted
something like:
System.Drawing.Image source = System.Drawing.Image.FromStream(fileUpload.PostedFile.InputStream);
// Opens the image from the stream
Bitmap bm = new Bitmap(100, 100, source.PixelFormat);
// Creates a new image in memory that is 100x100, using the same pixel format as the uploaded
Graphics g = Graphics.FromImage(bm);
// gets the graphics object from the image to redraw/resize on
g.DrawImage(source, new Rectangle(0, 0, 100, 100), new Rectangle(0, 0 , source.Width, source.Height), GraphicsUnit.Pixel);
// redraw the source image to the destination in memory one resized to 100x100
source.Dispose();
// clean up memory
bm.Save(fileName, GraphicsFormat.Jpeg);
// save the file to your filename, use whatever graphics format is appropriate
g.Dispose();
// clean up memory
bm.Dispose();
// clean up memory
there are other ways, i am not sure how good this is at keeping image quality, i have a much more complicated method in other apps, this was something i am playing with at the moment. it works though