S
shapper
Hello,
I need to resize an image contained on a
System.Web.HttpPostedFileBase.
I would like to keep the same format. I have the following:
public Stream Resize(HttpPostedFileBase image, Int32 height, Int32
width) {
using (Image source = Image.FromStream(image.InputStream, true,
true)) {
using (Bitmap resized = (Bitmap)source.GetThumbnailImage(100,
50, null, IntPtr.Zero)) {
MemoryStream output = new MemoryStream();
resized.Save(output, source.RawFormat);
return output;
}
}
} // Resize
Is this the best way to do this?
I am also using RawFormat to maintain the format.
Thank You,
Miguel
I need to resize an image contained on a
System.Web.HttpPostedFileBase.
I would like to keep the same format. I have the following:
public Stream Resize(HttpPostedFileBase image, Int32 height, Int32
width) {
using (Image source = Image.FromStream(image.InputStream, true,
true)) {
using (Bitmap resized = (Bitmap)source.GetThumbnailImage(100,
50, null, IntPtr.Zero)) {
MemoryStream output = new MemoryStream();
resized.Save(output, source.RawFormat);
return output;
}
}
} // Resize
Is this the best way to do this?
I am also using RawFormat to maintain the format.
Thank You,
Miguel