Python Forum

Full Version: creating an image
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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()