Difference between Bitmap.Height and VerticalResolution

有些话、适合烂在心里 提交于 2019-11-29 10:59:31

The dots-per-inch property is important when you want to make sure that an image is displayed on an output device with the same physical size as when it was created. The best example is an image you create with Microsoft Paint. While you work on it, you use your monitor. Which typically has a resolution of 96 pixels per inch. So a 960 x 960 image will display as (roughly) a 10 x 10 inch image on your monitor.

Now you print it. Printers are high resolution devices, 600 dots per inch is pretty normal. Which means that your 960 x 960 pixel image will be printed as a 960 / 600 = 1.6 x 1.6 inch image on paper. Your nice design turned into a postage stamp.

Clearly that's not desirable, the image needs to be rescaled to look similar on paper as it does on the monitor. The dots-per-inch property of the image lets you do this. The Image.Horizontal/VerticalResolution properties tell you 96, the printer's Graphics.DpiX/Y tell you 600, you know you have to rescale by 600/96 to get the same size image.

Do note that there's a side-effect. Every one pixel you drew in Microsoft Paint is turned into a 6 x 6 blob on paper due to the rescaling. The pixels on the paper are very small though so the image is likely to look the same. As long as the image has smooth transitions, like a photo. What does not work well is text, especially the anti-aliased kind. Which is otherwise why screen-shots look so much poorer compared to a report that was generated for a printer.

The Vertical/HorizontalResolution properties tell you how many pixels per inch this image is defined as using. So heres some examples..

An image of 100 px by 100 px @ 50x50 ppi means that when printed the image will consume 2in by 2in. (100 / 50)

Using your numbers: 375 x 65 @ 150.01239 = ~2.5 x .43 inches.

The average computer monitor is set to 72 ppi, but this is not guaranteed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!