This is my code to save images. The code works fine and i have no issues with it.
Guid id = Guid.NewGuid();
string strRealname = Path.GetFileName(ImageUrl);
string exts = Path.GetExtension(ImageUrl);
WebClient webClient = new WebClient();
webClient.DownloadFile(ImageUrl, Server.MapPath("~/Images/") + id + exts);
I want to be able to save the image according to my SET dimensions. For example: an image I download is 600x300. I want to keep the original dimensions(2:1) and save it as 400x200. How can I do this?
EDIT: Maybe i Should have stressed this point. I dont want to save the orginal image from the URl. Some of the images would be more than 1000px in width or height. I want to downscale this before saving. this will be done for 1000's of Images and I dont want my server to run out of of disk space.