wordcloud.ImageColorGenerator

class wordcloud.ImageColorGenerator(image)[source]

Color generator based on a color image.

Generates colors based on an RGB image. A word will be colored using the mean color of the enclosing rectangle in the color image.

After construction, the object acts as a callable that can be passed as color_func to the word cloud constructor or to the recolor method.

Parameters:

image : nd-array, shape (height, width, 3)

Image to use to generate word colors. Alpha channels are ignored. This should be the same size as the canvas. for the wordcloud.

Methods

__call__(word, font_size, font_path, ...) Generate a color for a given word using a fixed image.
__init__(image)[source]