1bpp 单色 BMP

发布于 2024-12-12 16:29:02 字数 401 浏览 5 评论 0原文

我运行了一个演示 bmp 文件格式帮助程序“DDDemo.exe”来帮助我可视化 32x1 像素 bmp 文件(单色)的格式。我对两个标题部分没问题,但似乎不理解颜色表和像素位部分。我制作了两个 32x1 像素的 bmp 文件来帮助我比较(请参阅附件)。

一黑一白像素等

16 个黑色像素,然后 16 个白色像素

有人可以帮助我理解“像素位”与颜色图的关系吗?

更新:经过一番尝试和错误,我终于能够编写 32x1 像素单色 BMP。尽管它与所附图像具有不同的像素位,但该工具有助于实现标题和颜色映射概念。感谢大家的意见。

I ran a demo bmp file format helper program "DDDemo.exe" to help me visualize the format of a 32x1 pixel bmp file (monochromatic). I'm okay with the the two header sections but dont seem to understand the color table and pixel bits portions. I made two 32x1 pixel bmp files to help me compare (please see attached).

one black then one white pixel etc

16 black pixels then 16 white pixels

Can someone assit me understand how the "pixel bits" relates to the color map?

UPDATE: After some trial and error I finally was able to write a 32x1 pixel monochromatic BMP. Although it has different pixel bits as the attached images, this tool helped with the header and color mapping concept. Thank you for everyones input.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

離人涙 2024-12-19 16:29:02

PIXEL BITS 中的未设置位指的是第一个颜色表条目 (0,0,0),黑色,设置位指的是第二个颜色表条目 (ff,ff,ff),即白色。

“每像素 1 位 (1bpp) 格式支持 2 种不同的颜色(例如:黑色和白色,或黄色和粉色)。像素值存储在每一位中,第一个(最左边)像素存储在每个位中。第一个字节的最高有效位。每个位都是 2 种颜色表的索引。此颜色表采用 32bpp 8.8.8.0.8 RGBAX 格式。未设置的位将引用第一个颜色表条目。设置位将引用最后(第二个)颜色表条目。” - BMP 文件格式

An unset bit in the PIXEL BITS refers to the first color table entry (0,0,0), black, and a set bit refers to the second color table entry (ff,ff,ff), white.

"The 1-bit per pixel (1bpp) format supports 2 distinct colors, (for example: black and white, or yellow and pink). The pixel values are stored in each bit, with the first (left-most) pixel in the most-significant bit of the first byte. Each bit is an index into a table of 2 colors. This Color Table is in 32bpp 8.8.8.0.8 RGBAX format. An unset bit will refer to the first color table entry, and a set bit will refer to the last (second) color table entry." - BMP file format

冧九 2024-12-19 16:29:02

这些图像的颜色表只是表明图像中有两种颜色:

  • 颜色 0 是 (00, 00, 00) -- 纯黑色
  • 颜色 1 是 (FF, FF, FF) -- 纯白色

不过,所示的图像压缩方法(BI_RGB -- 未压缩)对于给定的像素数据和图像没有意义。

The color table for these images is simply indicating that there are two colors in the image:

  • Color 0 is (00, 00, 00) -- pure black
  • Color 1 is (FF, FF, FF) -- pure white

The image compression method shown (BI_RGB -- uncompressed) doesn't make sense with the given pixel data and images, though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文