def text2array(text, fontsize=100):

    text2png(text, fn="_text", fontsize=fontsize)
    A = plt.imread("_text.png")[:, :, :3].mean(axis=2)
    os.remove("_text.png")
    return A.max() - A
Renders inputted text, and returns array representation.
dataset/ETHPy150Open thearn/stl_tools/stl_tools/text2png.py/text2array