为什么在BMP图片中,像素的排布为BGR

为什么在BMP图片中,像素的排布为BGR,而不是RGB?


这个问题长时间不太理解,直到最近受到好奇心驱使,到网上去查了一下,然后发现了一个答案,至于对不对,不敢保证,算是给了自己一个说法。


答案的来源是这里: 為啥BMP圖中象素的排列順序是BGR


其中网友回 whoishere  回复 :

MSDN中有说明啊,摘录给你看看:

Platform SDK: Windows GDI

COLORREF
The COLORREF value is used to specify an RGB color.

typedef DWORD COLORREF;
typedef DWORD *LPCOLORREF;
Remarks
When specifying an explicit RGB color, the COLORREF value has the following hexadecimal form:

0x00bbggrr
The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF.

To create a COLORREF color value, use the RGB macro. To extract the individual values for the red, green, and blue components of a color value, use the GetRValue, GetGValue, and GetBValue macros, respectively.


里面说: 一个RGB颜色的16进制值表示是: 0x00bbggrr ,在小端存储的模式下,读取到的顺序正好就是 rr gg bb 00, 也就是RGB的顺序。

所以,

结论是: 这里在保存的时候使用BGR顺序,是为了读取时候的方便。


当然,以上只是我的推测,如果有知道确切原因的,还请分享下,我好改正~~



  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值