def rgb_to_pil(r, g=None, b=None):
if type(r) in [list,tuple]:<EOL><INDENT>r, g, b = r<EOL><DEDENT>r, g, b = [min(int(round(v*<NUM_LIT:255>)), <NUM_LIT:255>) for v in (r, g, b)]<EOL>return (b << <NUM_LIT:16>) + (g << <NUM_LIT:8>) + r<EOL>
Convert the color from RGB to a PIL-compatible integer.

    Parameters:
      :r:
        The Red component value [0...1]
      :g:
        The Green component value [0...1]
      :b:
        The Blue component value [0...1]

    Returns:
      A PIL compatible integer (0xBBGGRR).

    >>> '0x%06x' % rgb_to_pil(1, 0.5, 0)
    '0x0080ff'