Skip to content

Instantly share code, notes, and snippets.

@InputBlackBoxOutput
Created October 18, 2021 10:37
Show Gist options
  • Save InputBlackBoxOutput/24af5e414d69a3c80c3a54d16eea1f95 to your computer and use it in GitHub Desktop.
Save InputBlackBoxOutput/24af5e414d69a3c80c3a54d16eea1f95 to your computer and use it in GitHub Desktop.
Functions to save and show an image in IPYNB notebooks
import matplotlib.pyplot as plt
def save_image(img, filename="image.png"):
plt.plot(), plt.imshow(img)
plt.xticks([]), plt.yticks([])
plt.axes("off")
plt.savefig(filename)
def show_image(img, title="title"):
plt.plot(), plt.imshow(img)
plt.title(title), plt.xticks([]), plt.yticks([])
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment