admin管理员组

文章数量:1355535

The question is, what is the difference between color depth and pixel depth?

Searching Pixel Depth on google simply give links to Color Depth. Even the dictionary defines pixel Depth as bit depth, which according to wikipedea is actually Color Depth. Wikipedia says,

Color depth, also known as bit depth, is either the number of bits used to indicate the color of a single pixel...

So does it mean "Color Depth", "Bit Depth" and "Pixel Depth" are all one and the same thing? If yes then is this w3schools article wrong which says,

For modern puters, Color Depth and Pixel Depth are equal.

The line above implies in older puter Color Depth and Pixel Depth were different.

The question is, what is the difference between color depth and pixel depth?

Searching Pixel Depth on google simply give links to Color Depth. Even the dictionary defines pixel Depth as bit depth, which according to wikipedea is actually Color Depth. Wikipedia says,

Color depth, also known as bit depth, is either the number of bits used to indicate the color of a single pixel...

So does it mean "Color Depth", "Bit Depth" and "Pixel Depth" are all one and the same thing? If yes then is this w3schools article wrong which says,

For modern puters, Color Depth and Pixel Depth are equal.

The line above implies in older puter Color Depth and Pixel Depth were different.

Share Improve this question asked Apr 27, 2016 at 5:43 user31782user31782 7,59716 gold badges79 silver badges157 bronze badges 4
  • 2 Breaking news: w3schools site is incorrect in some article. – zerkms Commented Apr 27, 2016 at 5:47
  • 1 @zerkms You made a typo. It is, "Breaking news: w3schools site is incorrect in most articles." – user31782 Commented Apr 27, 2016 at 5:50
  • Then it would not be breaking. – zerkms Commented Apr 27, 2016 at 5:51
  • This is called editing, wrong editing :p – Leo the lion Commented Apr 27, 2016 at 5:55
Add a ment  | 

1 Answer 1

Reset to default 9

Nice, all that w3Schools bashing in the ments, but they are actually right. The article is not about the terms pixel depth vs color depth, but about the properties of the screen object.

screen.pixelDepth and screen.colorDepth are two different properties, so it's imaginable that they have different values.

At the time of writing this answer, they were fixed to 24 (says also Mozilla). This is by specification, although there was a bug in WebKit that made it return 32..

The examples on the Mozilla page suggest that they could be lower, but currently (on modern puters, including modern smartphones) they are often 24. Some browsers on some devices may return higher values too, but 24 is by specification the standard value when the browser doesn't know the actual value, or doesn't want to expose it. Whichever, they are linked nowadays, and both properies should return the same value.

The real answer can be found on QuirksMode:

The difference between colorDepth and pixelDepth is only important on (older?) Unix machines, where old X-clients may allow applications to define their own color scheme. If that’s the case, colorDepth matches the color depth of the application and pixelDepth the color depth of the monitor. In all other cases they’re equal.

So it seems that that remark is correct.

In daily use, you might consider using colorDepth, because pixelDepth is not supported in IE8 and before, although that is hardly relevant today.

本文标签: javascriptPixel Depth vs Color DepthStack Overflow