   help: arithmetic on conversion between different color detph
  is anyone help me? thanks   
  Color depths come in a lot of varieties.  You've got 8-bit indexed (we'll ignore this one), r5g6b5, r5g5b5a1, a8r8g8b8, x8r8g8b8, etc. etc.  The only ones where you have to do actual conversion instead of just rearranging the bytes is going from 24- or 32-bit to 16-bit.  To convert from 8-bit to lower bits, shift right:char r = 128; //half intensity, 8 bits.r >> 3; //r == 16.  Half intensity, 5 bits.//ORr >> 2; //r == 32.  Half intensity, 6 bits.~BenDilts( void );;  Generally, converting from a color depth of m bits to n bits is done like this:Cn = Cm * ( 2n-1 ) / ( 2m-1 ) However, since you are usually dealing with integers, you must also include rounding:Cn = ( Cm * ( 2n-1 ) + ( 2m-1 ) / 2 ) / ( 2m-1 ) For example, to convert from 8 bits to 4 bits:C4 = ( C8 * 15 + 127 ) / 255 That gives you the following conversions:  0    0 8    016    132    264    4    128    8    191   11    219   13    239   14    247   15    255   15 Note: simply shifting as BeanDog suggests will give you poor results (though they may be adequate).   ;  i get it,thanks you all.