0

I know how to get the DPI on an image in C# .HorizontalResolution; .VerticalResolution; But what's the difference between these two lines of code, could these values be different than each other?

My point Is; When I scan an image using a printer, it asks me to set the dpi for the scanned image. So, that value will be represented inside .HorizontalResolution; Or .VerticalResolution;?

Ahmad
  • 252
  • 1
  • 11
  • As of now, these properties return the same value. In the future, who knows. But all DPI values should be considered in relation to the device that will show/print/scan the Bitmap. Hans Passant gives an easy-to-read description here: [Difference between Bitmap.Height and VerticalResolution](https://stackoverflow.com/a/6221550/7444103) and here: [Image.HorizontalResolution and Image.VerticalResolution](https://stackoverflow.com/a/33120375/7444103). Also in relation with what you're asking. – Jimi Jan 01 '19 at 22:33
  • The values usually are the same but could well be different. Depending on the source this would mean that the image will be stretched when displayed by a device or processed by code that honors these values. GDI drawing with DrawImage will. The scanner will almost certainly put the same value there. You can play by changing it later in code and doing a DrawImage before and after.. – TaW Jan 01 '19 at 23:24

0 Answers0