Python Forum
creating an image - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: creating an image (/thread-17806.html)



creating an image - Rafi - Apr-24-2019

Hi,
I have a CSV file with numbers I would like to show this file as an image where each number represent a pixel value.How do I do it in Python?
Where can I find material on image show in Python ?
Thanks


RE: creating an image - gontajones - Apr-24-2019

import numpy as np
from matplotlib import pyplot as plt

# Generates an 50x50 array with random values between 0-1
# You must load your CSV into data
data = np.random.random((50, 50))

# Create the image and show it
plt.imshow(data, interpolation='nearest')
plt.show()