Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Get DPI of Image in C#

Tags:

c#

dpi

how can i get dpi of an image using asp.net c#

like image 979
Avinash Avatar asked Jan 13 '10 05:01

Avinash


People also ask

How do I find the DPI of an image?

To find out an image's DPI in Windows, right-click on the file name and select Properties > Details. You'll see the DPI in the Image section, labeled Horizontal Resolution and Vertical Resolution. On a Mac, you need to open the image in Preview and select Tools > Adjust Size. It's labeled Resolution.

How do I find the resolution of a PNG?

Right-click on the image and then select "Properties." A window will appear with the image's details. Go to the "Details" tab to see the image's dimensions and resolution.


1 Answers

How about Image.HorizontalResolution and Image.VerticalResolution? Like this:

System.Drawing.Image image = System.Drawing.Image.FromFile("TestImage.bmp");
var dpiX = image.HorizontalResolution;
var dpiY = image.VerticalResolution;
like image 180
Benny Avatar answered Sep 29 '22 23:09

Benny