18

如何使用asp.net c#获取图像的dpi

4

2 回答 2

25

Image.HorizontalResolution和怎么样Image.VerticalResolution?像这样:

System.Drawing.Image image = System.Drawing.Image.FromFile("TestImage.bmp");
var dpiX = image.HorizontalResolution;
var dpiY = image.VerticalResolution;
于 2010-01-13T05:03:48.003 回答
0

答案在这篇文章中说明,它的代码来自这里

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");
        }
    }
}
于 2010-01-13T05:05:08.883 回答