why is there a color palette table after the header in bitmap's

心已入冬 提交于 2021-02-10 15:29:11

问题


Why can bitmaps with pixel depth higher than 8 bit can do without a color table and the ones with 8 bit and below require a color palette table ?


回答1:


Because bitmaps with a pixel depth of 8 bits and lower do not necessarily use a fixed color table. Instead, they define a custom optimized 8-bit color table that contains only the specific colors used in that particular bitmap image. In other words, they use a "selective" palette.

Remember that bitmaps are indexed images, which means that the color of each pixel is defined by an integer value that specifies an index into the color palette.

The advantage is that on systems with very limited color display capabilities, the bitmap's color palette can be optimized for those specific colors that the bitmap uses, rather than some generic list of colors.

For comparison purposes, here are two sample images. Both of them use only an 8-bit color palette, but the one on the left uses an optimized (or "selective") color palette, while the one on the right was forced into conformity with the standard Windows 256-color palette:

      Lena 8-bit (optimized)                         Lena 8-bit (non-optimized)

The difference in quality and color fidelity is immediately clear. The one on the left is far superior, even with the same 8 bits per pixel to play with.

Once you get above 8 bits per pixel, this isn't very important. The "standard" or "generic" colors give you plenty to work with to produce a recognizable image. That's not so with only 256 colors, much less 16.




回答2:


Because the 4/8 bit values are an index into a 16/256 entry colour table, whereas with 24-bits the values are specifying the actual intensity of the Reg, Green, and Blue components of each pixel.



来源:https://stackoverflow.com/questions/8574896/why-is-there-a-color-palette-table-after-the-header-in-bitmaps

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!