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 :: python init dict by list 
Python :: reverse order of dataframe rows 
Python :: dependency inversion 
Python :: alphabetical 
Python :: difference between == and is 
Python :: how to change theme of jupyter notebook 
Python :: fast fourier transform 
Python :: how i get url value in get_queryset function in drf 
Python :: how to use import command in python 
Python :: Python NumPy ndarray.T Example to convert an array 
Python :: how to redirect where requests library downloads file python 
Python :: empty array numpy python 
Python :: Amazing Trees with python turtle 
Python :: pygame image get height 
Python :: remove SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame 
Python :: fillna pandas inplace 
Python :: python ordered indexs of a list 
Python :: choice without replacement python 
Python :: how to get checkbutton from a list 
Python :: horizontal line to the y axis in matplotlib 
Python :: how to create a spark schema using a string 
Python :: insert value in string python 
Python :: numpy filter based on value 
Python :: python emoji convert 
Python :: Python colon equals 
Python :: compiling python code 
Python :: all python statements 
Python :: * in python 
Python :: The MEDIA_URL setting must end with a slash. 
Python :: centos install python 3.9 thelinuxterminal.com 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =