Answers for "matplotlib convert array to image"

7

pil image to numpy array

>>> pix = numpy.array(pic)
Posted by: Guest on June-17-2020
0

convert plt image to numpy

canvas = pyplot.gca().figure.canvas
canvas.draw()
data = numpy.frombuffer(canvas.tostring_rgb(), dtype=numpy.uint8)
image = data.reshape(canvas.get_width_height()[::-1] + (3,))
Posted by: Guest on May-19-2021

Code answers related to "matplotlib convert array to image"

Python Answers by Framework

Browse Popular Code Answers by Language