Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python draw rectangle on image

img = matplotlib. image. imread("./kite_logo.png")
figure, ax = pyplot. subplots(1)
rect = patches. Rectangle((125,100),50,25, edgecolor='r', facecolor="none")
ax. imshow(img) Displays an image.
ax. add_patch(rect) Add rectangle to image.
Comment

add rectangle to image python

from PIL import ImageDraw

draw = ImageDraw.Draw(<your_image>)
draw.rectangle(((20, 30), (10, 10)), fill="white")		# (x1, y1), (x2, y2)

plt.imshow(test)
Comment

PREVIOUS NEXT
Code Example
Python :: break continue pass in python 
Python :: python update function 
Python :: django datefield year only 
Python :: readline python 
Python :: python parse xml string 
Python :: python string caps lock 
Python :: python < 
Python :: how to use pyplot 
Python :: add element to list python 
Python :: python array use numpy arange 
Python :: random forest 
Python :: round down number python 
Python :: store message sent by user in string discord py 
Python :: games made with python 
Python :: add new column to pandas dataframe 
Python :: counter method in python 
Python :: python ternary operators 
Python :: fraction in python 
Python :: python virtual env 
Python :: why is python so popular 
Python :: np.random.randint 
Python :: step function 
Python :: how to make an argument optional in python 
Python :: text to speech module python 
Python :: ImportError: cannot import name 
Python :: odd number in python 
Python :: python multiclass inheritance with inputs 
Python :: add in python 
Python :: python if else interview questions 
Python :: python all any example 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =