def image_to_base64(image):
    ax = image.axes
    binary_buffer = io.BytesIO()

    # image is saved in axes coordinates: we need to temporarily
    # set the correct limits to get the correct image
    lim = ax.axis()
    ax.axis(image.get_extent())
    image.write_png(binary_buffer)
    ax.axis(lim)

    binary_buffer.seek(0)
    return base64.b64encode(binary_buffer.read()).decode('utf-8')
DateFields with manually specified input formats can accept those formats
dataset/ETHPy150Open plotly/plotly.py/plotly/matplotlylib/mplexporter/utils.py/image_to_base64--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/tests/regressiontests/forms/tests/input_formats.py/SimpleDateFormatTests.test_dateField_with_inputformat