
.net图片下载的质量怎么控制?这个程序下西来的总是不清晰
publicvoidDownImage(){WebClientclient=newWebClient();foreach(KeyValuePair<string,stri...
public void DownImage()
{
WebClient client = new WebClient();
foreach (KeyValuePair<string, string> KeyValue in replace)
{
FileInfo info = new FileInfo(KeyValue.Value);
if (!info.Directory.Exists)
info.Directory.Create();
try
{
client.DownloadFile(KeyValue.Key, KeyValue.Value);
System.Drawing.Image image = System.Drawing.Image.FromFile(KeyValue.Value);
int width =image.Width;
image.Dispose();
if (width>700)ImageFunction.Compress(KeyValue.Value, 700, 0, true);
if (width > 200) ImageFunction.WaterMark(KeyValue.Value, MarkPath);
}
catch(Exception ex)
{
Log("ImageError:" + ex.Message);
}
}
} 展开
{
WebClient client = new WebClient();
foreach (KeyValuePair<string, string> KeyValue in replace)
{
FileInfo info = new FileInfo(KeyValue.Value);
if (!info.Directory.Exists)
info.Directory.Create();
try
{
client.DownloadFile(KeyValue.Key, KeyValue.Value);
System.Drawing.Image image = System.Drawing.Image.FromFile(KeyValue.Value);
int width =image.Width;
image.Dispose();
if (width>700)ImageFunction.Compress(KeyValue.Value, 700, 0, true);
if (width > 200) ImageFunction.WaterMark(KeyValue.Value, MarkPath);
}
catch(Exception ex)
{
Log("ImageError:" + ex.Message);
}
}
} 展开
2个回答
展开全部
楼主:请问你是否是讲求图片质量?也就是图片的像素?这个你可以设置的,调用像素哪个关键字吧,我记得不是很清楚了,你可以在winform里面看下

2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询