What is the relevance of DPI in BitmapSource.Create() method?
Asked Answered
S

1

8

i read the Wikipedia article on DPI, but it confused me even more... i don't have any DPI information on the image. What DPI should i use with BitmapSource.Create(), is it OK to use a constant one(96/72?) and does it really matter if i'm not going to be printing the image?

Seychelles answered 22/3, 2013 at 20:31 Comment(3)
This might be helpful: Be Aware of DPI with Image PNGs in WPF. There is hardly any need to ever use anything else than 96, as that is the default device independent unit size in WPF.Minute
Thank you! Will read up. Since i'm using Photoshop image data, i noticed that the default for Photoshop is 72 and i'm not certain weather passing it to BitmapSource.Create() as 96 wouldn't damage the image. Yup, Explained in the first link. Thanks!Seychelles
i would like to see a comment on the random down votes this answer's been getting lately, please tell me how you find it un-useful so i can try to improve it (or vote to close it)... i can assure you there was research effort on my side.Seychelles
R
13

DPI does not affect the pixels of a bitmap in any way. The DPI of an image is just attached metadata that is a measurement used to describe how large in real-world measurements is each pixel supposed to be.

For example, you can have two images which both represent an 8.5" x 11" scanned piece of paper. One might be from a higher resolution scanner at 600 dpi and therefore the dimensions of the pixels would be 5100x6600 at 600 dots per inch. That same piece of paper could be scanned by a lower resolution scanner at 300 DPI and therefore would only have a resolution of 2550x3300.

Now let's say you want to display both of these images on the screen side by side to compare the pieces of paper. They should be the same size on your screen. Most likely the larger image would be scaled down and not all of the pixels would be visible. They are still there however, and if you zoom in on the image you'd see the finer quality. Zooming in on the lower resolution image would result in a significantly lower quality.

DPI is used to allow you to show various images on the screen and have them maintain proper size ratio to each other. It's also important for printing.

As a rule you should stick with the default DPI of 96 unless you have a reason not to.

Riant answered 22/3, 2013 at 23:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.