Plot & save the image with PIL & numpy

    plt.subplot(1, 3, 3)
    plt.title('Detected Face')
    plt.imshow(new_img)
    plt.axis('off')
    plt.show()

    # new_img = np.transpose(new_img,(1,0,2))

    new_img = Image.fromarray(new_img,"RGB")
    new_img.save(filename)

I used the code like above. I show the image with the variable called ‘new_img’. It shows me to the image perfectly. However, when I change the numpy array with ‘fromarray’ command, it may not work. I want to save the image same with which I printed at plt.imshow. How can I modify the code???

It looks good to me, perhaps your image has the wrong shape. Can you print the shape of the new_img? print(new_img.shape)

What error are you getting with the current code?