import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from PIL import Image, ImageFilter
import numpy as np
import matplotlib.pyplot as plt
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
tf.reset_default_graph()
im=mnist.test.images[1].reshape((28,28)) #The read format is Ndarry
img= Image.fromarray(im*255) #Image and Ndarray are converted to each other
img= img.convert('RGB ') #jpg can be in RGB mode or CMYK mode
img.save(r'G:\Exercise\Python\02.jpg') #Save
plt.imshow(im,cmap="gray")
plt.show( ) #display
# ############################################## #####