# Convert Matplotlib figure into PIL Image

Created at 2018-10-24 Updated at 2018-10-24 Category Matplotlib Tag Matplotlib

These days, I want to use Tensorboard to show images created by Matplotlib or its counterparts. And the most important part is converting Matplotlib’s figure into PIL image class in memory, after googling for a while, I got the solution, here it is

Note that Searborn is a simple to use data visualization library built on Matplotlib, in the code above, there is a canvas instance which converts figure into string_rgb format so that it can be converted into an instance of PIL Image class for later use.

And you can easily convert pil_image into a numpy Array

Reference

## Table of Content

Site by GoingMyWay using Hexo & Random

I am a ML and RL research student

Hide