Help with getting data from resized image.
Posted
by
nick
on Stack Overflow
See other posts from Stack Overflow
or by nick
Published on 2011-01-08T23:41:10Z
Indexed on
2011/01/08
23:54 UTC
Read the original article
Hit count: 119
I'm using an ASP.NET file upload control and then resizing an image and storing the new image in a new Bitmap. Here is the code I have so far:
protected void ResizeImage()
{
Bitmap originalBMP = new Bitmap(FileUpload1.FileContent);
//Calculate new image dimensions
int origWidth = originalBMP.Width;
int origHeight = originalBMP.Height;
int sngRatio = origWidth / origHeight;
int newWidth = 100;
int newHeight = newWidth / sngRatio;
Bitmap newBMP = new Bitmap(originalBMP, newWidth, newHeight);
}
I'm uploading directly to Amazon S3 and I need to pass some data to its upload method. How do I get the following information from my new bitmap that I have been using with the fileupload?:
FileUpload1.FileBytes
FileUpload1.FileBytes.Length
Do I need to save my new bitmap to a stream so I can get an array of bytes?
© Stack Overflow or respective owner