Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pillow python crop

im = Image.open('image.jpg') 
im = im.crop((left, top, width, height))

#       ├─input image width─┤
#   ┬   ┌───────────────────┐ ┬   ┬   
#   │   │                   │top  │   
# input │       ┌───────┐   │ ┴ height
# image │       │       │   │     │   
# height│       └───────┘   │     ┴   
#   │   │                   │  
#   ┴   └───────────────────┘   
#       ├─left─┤
#       ├─────width─────┤
Comment

pil crop image

im = Image.open('image.jpg') 
im = im.crop((left, top, right, bottom))  # coordinates of the crop
Comment

PREVIOUS NEXT
Code Example
Python :: display np array as image 
Python :: how to put a text file into a list python 
Python :: how to set the current working directory in python 
Python :: python click buttons on websites 
Python :: matplotlib get rid of gridlines 
Python :: python pie chart 
Python :: pandas add dataframe to the bottom of another 
Python :: how i install jupyter notebook in a new conda virtual environment 
Python :: enter key press bind tkinter 
Python :: how to find element in selenium by class 
Python :: flask get ip address of request 
Python :: discord py bot status 
Python :: save file python tkinter 
Python :: python how to read a xlsx file 
Python :: how to find the mode using pandas groupby 
Python :: python filter array 
Python :: return result from exec python 
Python :: draw a line pygame 
Python :: write a python program to read last n lines of a file 
Python :: python barcode generator 
Python :: select closest number in array python 
Python :: pandas set a column as index 
Python :: image to text python 
Python :: split a path into all subpaths 
Python :: export python pandas dataframe as json file 
Python :: django queryset group by count 
Python :: how to draw image in tkinter 
Python :: generate a list of random numbers python 
Python :: discord.py presence 
Python :: generate random string python 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =