def fig2img (fig):
    # put the figure pixmap into a numpy array
    buf = fig2data ( fig )
    w, h, d = buf.shape #@UnusedVariable
    return Image.fromstring( "RGBA", ( w ,h ), buf.tostring( ) )
Convert a Matplotlib figure to a PIL Image in RGBA format and return it
dataset/ETHPy150Open victor-gil-sepulveda/pyProCT/pyproct/tools/plotTools.py/fig2img