小编Zyn*_*Zyn的帖子

下载时如何调整图像大小?

我想在下载或下载后调整图像大小.这是我的代码.质量并不重要.

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)

那我该怎么办呢?

c# asp.net resize image download

3
推荐指数
1
解决办法
5062
查看次数

标签 统计

asp.net ×1

c# ×1

download ×1

image ×1

resize ×1