Created
June 17, 2020 07:54
-
-
Save xtellurian/b66171c9bc0c1216a2d1203cb06bb226 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
img_path="path_to/image.tiff" | |
image = Image.open(jpg_path) | |
# get the current width and height | |
width, height = image.size | |
# Setting the points for cropped image | |
# you can change these values | |
left = width * 2 / 5 | |
right = width * 3 / 5 | |
top = height * 2 / 5 | |
bottom = height * 3 / 5 | |
im1 = image.crop((left, top, right, bottom)) | |
im1.save("output_directory/output.tif") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pillow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment