30686/how-to-save-numpy-array-as-image-in-python
I have a matrix in the type of a Numpy array. How would I write it to disk it as an image? Any format works (png, jpeg, bmp...). One important constraint is that PIL is not present.
If you have matplotlib, you can do:
import matplotlib.pyplot as plt plt.imshow(matrix) #Needs to be in row,col order plt.savefig(filename)
This will save the plot (not the images itself).
Hi, @Roshni, The following code is used to ...READ MORE
Python doesn't have a native array data ...READ MORE
print(*names, sep = ', ') This is what ...READ MORE
Slicing is basically extracting particular set of ...READ MORE
suppose you have a string with a ...READ MORE
You can also use the random library's ...READ MORE
Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE
Enumerate() method adds a counter to an ...READ MORE
HDF5 works fine for concurrent read only ...READ MORE
Good question, glad you brought this up. I ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.