Created
April 12, 2021 18:32
-
-
Save xiongnemo/bcad4bc31827199a7b09cab6562caf99 to your computer and use it in GitHub Desktop.
Crop pics in list supplied according to left-upmost and right-downmost points
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 | |
with open("list.txt", "r", encoding='utf-8') as input_file_path_list_file: | |
input_file_path_list = input_file_path_list_file.readlines() | |
for input_file_path in input_file_path_list: | |
input_file_path = input_file_path.strip() | |
if input_file_path.strip() == "": | |
continue | |
current_img = Image.open(input_file_path) | |
# outi ni kaerumadega mashimaro desu | |
cropped_img = current_img.crop((0, 110, 2010, 1060)) | |
cropped_img.save(f"cropped_{input_file_path}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment