Answers for "plt save numpy array as image"

0

save numpy arrayw with PIL

from PIL import Image
im = Image.fromarray(A)
im.save("your_file.jpeg")
Posted by: Guest on April-18-2021
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

Python Answers by Framework

Browse Popular Code Answers by Language