Load plotly figure with PIL without exporting as a file

I just found your answer here Render plotly figure as numpy ndarray of rgba pixels, this solves my problem. Converting to png is fine as far as I don’t need to export the image as a file. Thanks!