Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用asp.net c#获取图像的dpi
Image.HorizontalResolution和怎么样Image.VerticalResolution?像这样:
Image.HorizontalResolution
Image.VerticalResolution
System.Drawing.Image image = System.Drawing.Image.FromFile("TestImage.bmp"); var dpiX = image.HorizontalResolution; var dpiY = image.VerticalResolution;
答案在这篇文章中说明,它的代码来自这里:
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"); } } }