我想在下载或下载后调整图像大小.这是我的代码.质量并不重要.
public void downloadPicture(string fileName, string url,string path) {
string fullPath = string.Empty;
fullPath = path + @"\" + fileName + ".jpg"; //imagePath
byte[] content;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
using (BinaryReader br = new BinaryReader(stream)) {
content = br.ReadBytes(500000);
br.Close();
}
response.Close();
FileStream fs = new FileStream(fullPath, FileMode.Create); // Starting create
BinaryWriter bw = new BinaryWriter(fs);
try {
bw.Write(content); // Created
}
finally {
fs.Close();
bw.Close();
}
}
Run Code Online (Sandbox Code Playgroud)
那我该怎么办呢?