documentation index ◦ reference manual ◦ function index

# im.Twocolor

Function: | im.Twocolor | (im, white, black, force_alpha=False, **properties):

This takes as arguments two colors, white and black. The image is mapped such that pixels in white have the white color, pixels in black have the black color, and shades of gray are linearly interpolated inbetween. The alpha channel is mapped linearly between 0 and the alpha found in the white color, the black color's alpha is ignored.

## Example

    init:
        image cyan twocolor = im.Twocolor("blackwhite.png",
                                          (0, 255, 255, 255),
                                          (255, 255, 0, 255))

documentation index ◦ reference manual ◦ function index