如何将24位RGB转换为8位RGB [英] How to convert 24 bit RGB to 8 bit RGB

查看:3717
本文介绍了如何将24位RGB转换为8位RGB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道什么是最好的方式将24位RGB颜色(每种颜色8位)转换为8位颜色(2bits蓝色,3绿色,3红色)。

I was wondering what is the best way to convert a 24-bit RGB color (8 bits per color) into an 8-bit color (2bits Blue, 3 Green, 3 Red). I'd like C code for doing this.

推荐答案

8位RGB通常是一个索引(调色)的颜色格式, a href =http://en.wikipedia.org/wiki/Palette_%28computing%29> Palette(计算)。

8 bit RGB is normally an indexed (palettized) color format, see Palette (computing).

您的方式描述它,虽然,从24 bpp得到8 bpp是相当简单 - 你需要剥离最低有效位,并将这些位合并为单字节值,每个像素。 AFAIK它不是标准或众所周知的像素颜色表示。

The way you described it though, getting 8 bpp out of 24 bpp is pretty straightforward - you would need to strip least significant bits and merge the bits into single byte value, per pixel. AFAIK it is not a standard or well-known pixel color representation.

这篇关于如何将24位RGB转换为8位RGB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆