[英]How to Get DPI of Image in C#
如何使用asp.net c#获取图像的dpi
How about Image.HorizontalResolution
and Image.VerticalResolution
? Image.HorizontalResolution
和Image.VerticalResolution
怎么Image.VerticalResolution
? Like this: 像这样:
System.Drawing.Image image = System.Drawing.Image.FromFile("TestImage.bmp");
var dpiX = image.HorizontalResolution;
var dpiY = image.VerticalResolution;
The answer is stated in this post , which sources it's code from here : 答案在这篇文章中说明 ,它从这里获取代码:
using System;
using System.Drawing;
namespace BitmapDpi
{
class Program
{
static void Main(string[] args)
{
Bitmap bmp = new Bitmap("winter.jpg");
Console.WriteLine("Image resolution: " + bmp.HorizontalResolution + "DPI");
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.