public void getImg(string filename, out Size JpgSize, out float Wpx, out float Hpx)
{
try
{
Uri url = new Uri(filename);
BitmapFrame bi = BitmapFrame.Create(url, BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.OnDemand);
int w = bi.PixelHeight;
int h = bi.PixelWidth;
JpgSize = new Size(w, h);
Wpx = (float)bi.DpiX;//分辨率
Hpx = (float)bi.DpiY;//分辨率
}
catch
{
JpgSize = new Size(0, 0);
Wpx = 0; Hpx = 0;
}
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
请登录后查看评论内容