Pixel dilemma and WPF


History
The word pixel was first published in 1965 by Frederic C. Billingsley of JPL, to describe the picture elements of video images from space probes to the moon and Mars; but he did not coin the term himself, and the person he got it from (Keith E. McFarland at the Link Division of General Precision in Palo Alto) does not know where he got it, but says it was “in use at the time” (circa 1963).
The word is a combination of picture and element, via pix. Pix was first coined in 1932 in a Variety Magazine headline, as an abbreviation for the word pictures, in reference to movies; by 1938 pix was being used in reference to still pictures by photojournalists.
The concept of a picture element dates to the earliest days of television, for example as Bildpunkt (the German word for pixel, literally picture point) in the 1888 German patent of Paul Nipkow. According to various etymologies, the earliest publication of the term picture element itself was in Wireless World magazine in 1927,though it had been used earlier in various U.S. patents filed as early as 1911.

Definition
A pixel is generally thought of as the smallest single component of an image. The definition is highly context sensitive; for example, we can speak of printed pixels in a page, or pixels carried by electronic signals, or represented by digital values, or pixels on a display device, or pixels in a digital camera (photosensor elements). This list is not exhaustive, and depending on context there are several terms that are synonymous in particular contexts, e.g. pel, sample, byte, bit, dot, spot, etc. We can also speak of pixels in the abstract, or as a unit of measure, in particular when using pixels as a measure of resolution, e.g. 2400 pixels per inch, 640 pixels per line, or spaced 10 pixels apart.

WPF Pixel
WPF Pixel is not a “real” pixel, it is a virtual unit which does not map to to the device pixels. Then, what is it and why is it defined as 96 dpi(dots per Inch)? Does this mean, every inch on my screen will have 96 pixels but how is that possible?

This is not possible because of two reasons:

  • the pixels on the screen are dependent on the dimensions of the screen.
  • the pixels on the screen are dependent on the resolution of the screen.

Add to this, the DPI settings of the Operating system. Now it becomes real complicated. How does DPI of WPF, DPI of the Screen and DPI of OS come together?
Lets do some tests and try to understand it.
Calculate the DPI settings of your screen.
Suppose you are using 14″X12″ monintor and your screen resolution is set as 1280X1024. The screen of your computer is displaying exactly 1280/14 = 91 pixels per Inch. Now, we know that a WPF inch = 96 pixel. This indicates that 96WPF Pixel = 91 Device pixel in this case. This proves the point that WPF Pixel is a Device independent unit and has no one-to-one relationship with the Device Pixel.

Change the DPI setting of OS

  • Click on your Desktop
  • Click on Properties
  • Click on Settings
  • Click on Advanced Button
  • Go to General Tab
  • Change your DPI settings as shown below

Pixel dilemma and WPF

You will see the Normal DPI settings set as 96 pixel. If you set the DPI settings as 100% that is equivalent to 96 Device pixels and it maps to exactly one inch on the screen. This is the DPI settings of your Operating system.If you set the OS DPI to 96 DPI and make the WPF think you are using a 96 DPI display device a WPF pixel will map exactly to a pixel on your screen. Because, as we have learned, a WPF Pixel is defined to be 1/96″. If you set it to something higher such as 120 DPI WPF “thinks” it needs to use more pixels to get to the the size of one inch and a WPF Pixel will map to 1.25 real screen pixels

Conclusion

  • WPF pixel is different from Device pixel.
  • WPF pixel is a Virtual unit.
  • WPF Pixel is 1/96 inch.

2 Responses to “Pixel dilemma and WPF”


  1. #1 guvenlik sistemleri Aug 8th, 2008 at 7:49 pm

    You have excellent analysis. thanks for writting

  1. 1 what can not be represented by a single byte

Leave a Reply