我现在做的一个项目,是要将手机里的bmp转换出来,可以在windows里面看到。因为手机里的bmp结构与windows有所不同。但是现在出现了这么一个现象。手机里的图片是16bit的,我将其RGB分离出来之后低位补零,转换为24bit,但是颜色很失真。我是不是哪里做得不对了?我这里有失真的图和正确的图,哪位大虾有兴趣,我就发给他,帮我看看,谢谢。

解决方案 »

  1.   

    16bit 是不是RGB 5, 6, 5bit? 直接把各颜色分量*8 或 *4就可以了吧?
      

  2.   

    估计你颜色拆得不对,MSDN中的一段,希望对你有帮助16 The bitmap has a maximum of 2^16 colors. If the biCompression member of the BITMAPV5HEADER structure is BI_RGB, the bmiColors member is NULL. Each WORD in the bitmap array represents a single pixel. The relative intensities of red, green, and blue are represented with 5 bits for each color component. The value for blue is in the least significant 5 bits, followed by 5 bits each for green and red. The most significant bit is not used. The bmiColors color table is used for optimizing colors used on palette-based devices, and must contain the number of entries specified by the biClrUsed member of the BITMAPV5HEADER. 
    If the biCompression member of the BITMAPV5HEADER is BI_BITFIELDS, the bmiColors member contains three DWORD color masks that specify the red, green, and blue components, respectively, of each pixel. Each WORD in the bitmap array represents a single pixel.When the biCompression member is BI_BITFIELDS, bits set in each DWORD mask must be contiguous and should not overlap the bits of another mask. All the bits in the pixel do not need to be used. 
      

  3.   

    16BitBMP很特殊,有32K色(555)与64K色(565)两种,除早期一些显卡外,大多为565格式,所以分离RGB有点麻烦,三种转换方式,1、取BMP数据数组,逐像素换算,转换时,不能用补0方式,R、B分量需*8,G分量*4;2、更快的方式,新建一个24BitDIB,将图片绘入即可;3、更简单的方法,将图片导入PictureBox,直接用SavePicture Picture1.Image, "c:\1.bmp"保存,他总是会存为24Bit Bmp的。
      

  4.   

    16Bit的565BMP,我怎么做才能从16bit里面分别求到BRG啊?