Click here to Skip to main content
15,920,632 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,,
How to find the image height and width in Inches? I tried

C#
objImgDimensions.Width = (objImage.Width / objImage.HorizontalResolution);
objImgDimensions.Height = (objImage.Height / objImage.VerticalResolution);


but,I came to know that, the DPI shown in .net application is 96 and some apps like illustrator, it is around 72 or like that.

How can I get the accurate/standard height and width of image in inches irrespective of display device and application used..

any suggestion is appreciated.


thank you.
Posted

1 solution

In general case, the image does not have any certain size in inches. Some image format contains metadata showing "resolution", which is actually not resolution but suggested (default, intendend) dot per inch value, which can be used in printing, when the user want to print with the "original size" option. 72 dpi sounds ridiculous, it was often referred as default screen "resolution" (but modern monitors usually have much less pixel size, this "standard" is purely ad-hoc value, obsolete, something as stupid as "problem Y2000"), but real quality "resolution" for printing should be about 300 dpi as a minimum. Scanners usually support much better "resolution".

It simply makes little sense. Real image size is the number of pixels measured on both dimension. Drawing an image in screen to certain physical size is not usually used. It requires knowledge of the pixel size of the screen and is a variable value. Think about this way: you plug out one monitor, plug in another one. If your application is running, it will the same image on screen in a different physical size immediately; it won't receive any notification.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900