Python Forum
creating an image - Printable Version

+- Python Forum (
+-- Forum: Python Coding (
+--- Forum: General Coding Help (
+--- Thread: creating an image (/thread-17806.html)

creating an image - Rafi - Apr-24-2019

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 ?

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')