def putpalette(self, data, rawmode="RGB"):

        if self.mode not in ("L", "P"):
            raise ValueError("illegal image mode")
        self.load()
        if isinstance(data, ImagePalette.ImagePalette):
            palette = ImagePalette.raw(data.rawmode, data.palette)
        else:
            if not isStringType(data):
                data = string.join(map(chr, data), "")
            palette = ImagePalette.raw(rawmode, data)
        self.mode = "P"
        self.palette = palette
        self.palette.mode = "RGB"
        self.load() # install new palette

    ##
    # Modifies the pixel at the given position. The colour is given as
    # a single numerical value for single-band images, and a tuple for
    # multi-band images.
    # <p>
    # Note that this method is relatively slow.  For more extensive
    # changes, use {@link #Image.paste} or the <b>ImageDraw</b> module
    # instead.
    #
    # @param xy The pixel coordinate, given as (x, y).
    # @param value The pixel value.
    # @see #Image.paste
    # @see #Image.putdata
    # @see ImageDraw
Put palette data into an image.
dataset/ETHPy150Open kleientertainment/ds_mod_tools/pkg/win32/Python27/Lib/site-packages/PIL/Image.py/Image.putpalette