im.Map - Ren'Py

documentation index ◦ reference manual ◦ function index

# im.Map

Function: | im.Map | (im, rmap=im.ramp(0, 255), gmap=im.ramp(0, 255), bmap=im.ramp(0, 255), amap=im.ramp(0, 255), force_alpha=False, **properties):

This adjusts the colors of the image that is its child. It takes as arguments 4 256 character strings. If a pixel channel has a value of 192, then the value of the 192nd character in the string is used for the mapped pixel component.

The im.Map function can be used in a simple way, like im.Recolor, to scale down or remove color components from the source image, or it can be used in a more complex way to totally remap the color of the source image.

## Example

    init:
        image cyan green = im.Map("cyan.png", bmap=im.ramp(0, 0))
        image eileen inverse = im.Map('9a_happy.png', rmap=im.ramp(255,0),
                                      gmap=im.ramp(255,0), bmap=im.ramp(255,0))

    show cyan green at cyanpos with dissolve

    "The im.Map operation lets us mess with the red, green,
     blue, and alpha channels of an image."
    "In this case, we removed all the blue from the image,
     leaving only the green component of cyan."

    e "Ever have that feeling you're a character in a horror movie?"

    show eileen inverse with dissolve

    e "Right now, all my colors are inverted."

    show eileen happy with dissolve

    e "Back to normal.

documentation index ◦ reference manual ◦ function index