Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pixel Depth vs. Color Depth

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 computers, Color Depth and Pixel Depth are equal.

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

like image 845
user31782 Avatar asked Apr 27 '16 05:04

user31782


People also ask

What is pixel depth?

Answer. The pixel depth, or bit depth, determines the range of values that a particular raster file can store, which is based on the formula 2^n where n is the pixel depth. For example, an 8-bit raster can have 256 unique values, which range from 0 to 255.

What is the difference between color depth and bit depth?

minhajulhaque.com/… Bit depth appears to measure how many possible colors (including shades) an image has been saved with. Color depth is how many possible colors (including shades) a display device is capable of producing. So you could have a 32bit image displayed on a 8bit color display.

What is the colour depth of a pixel?

Color depth refers to the amount of color that each pixel can display. It is measured by the number of colors each pixel in an image can show. The higher the color depth, the more colors an image can display. Pixels store color information in a specific number of computer bits, ranging from one bit to 48 bits.

What is the difference between colour depth and resolution?

Color resolution refers to the ability of each pixel to represent a number of color tones (also called color depth or bit depth). Color resolution is normally measured by the level of ability to express the intensity of the 3 primary colors (red, green, and blue).


1 Answers

Nice, all that w3Schools bashing in the comments, 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 computers, 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.

like image 184
GolezTrol Avatar answered Oct 06 '22 19:10

GolezTrol