Bitmap如何存储RGBA原始位域?
我想了解位图原始数据是如何存储的。我读过不少关于位图存储的文章,但一篇文章指出位图文件的原始位域数据将以相反的顺序 (ABGR) 存储。然而,我发现了另一个显示 ARGB 的图表。因此,我不知道应该如何将位域转换为 RGBA 像素数组。
I am trying to understand how bitmap raw data is stored. I've read quite few articles on bitmap storage, but one article states that the raw bitfield data of a bitmap file will store in a reverse order (ABGR). However, I found another diagram showing ARGB instead. Therefore, I am not sure how should I convert the bitfield into array of RGBA pixel.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“这取决于”
内存和文件布局都有多种布局:您提到的两种是两种常见的布局。一般来说,每个 ARGB 分量(或“通道”)都是 8 位,但这也“取决于”。
维基百科有一些关于 BMP 文件格式 的信息:请注意 16、24 和32 位颜色深度!另请注意,虽然文章使用“RGBAX”来讨论采样,但数据可能在物理上布置为 XAGRB 或 BGR 等。“这取决于情况”。
无法将苹果与橙子进行比较,并且必须确保将橙子排除在苹果篮子之外。
快乐编码。
"It depends"
There are various layouts for both memory and file layouts: the two you mentioned are two common layouts. Generally each A-R-G-B component (or "channel") is 8-bits, but this also "depends".
Wikipedia has some information on the BMP file format: note the variation between the 16, 24 and 32-bit color depths! Also, note that while the articles uses "RGBAX" to talk about the sampling, the data might be physically laid out as XAGRB or BGR, etc. "It depends".
Can't compare apples to oranges, and have to make sure to keep the oranges out of the apple basket.
Happy coding.