Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Generate random image np array

import numpy as np
from PIL import Image
random_array = np.random.randint(low=0, high=255,size=(250,250),dtype=np.uint8)
random_im = Image.fromarray(random_array)
random_im.show()
Comment

generate a random np image array with shape

import numpy as np
from PIL import Image
random_array = np.random.rand(177,284,3)
random_array = np.random.random_sample(random_array.shape) * 255
random_array = random_array.astype(np.uint8)
random_im = Image.fromarray(random_array)
random_im.show()
Comment

PREVIOUS NEXT
Code Example
Python :: 2 list difference python 
Python :: json file to dict python 
Python :: how to add icon to tkinter window 
Python :: pandas reset row indices 
Python :: how ot split a string every fourth eter 
Python :: how can I sort a dictionary in python according to its values? 
Python :: python3 iterate through indexes 
Python :: how to create a keylogger in python 
Python :: how to get the size of an object in python 
Python :: discord.py intents 
Python :: HOw to use passlock password manager python 
Python :: pysimplegui double Slider 
Python :: purge command discord.py 
Python :: display Max rows in a pandas dataframe 
Python :: print all keys having same value 
Python :: managin media django 
Python :: delete unnamed 0 columns 
Python :: datetime not defined python 
Python :: how to install gym 
Python :: virtual environment mac 
Python :: python current date and time 
Python :: sklearn rmsle 
Python :: how to clear console in python 
Python :: delete image with python 
Python :: python get current number of threads 
Python :: python what does yield do 
Python :: python datetime round to nearest hour 
Python :: pandas capitalize column 
Python :: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly 
Python :: python install libs 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =