From 510dfa94f5056d133be7f738e2e4abec2d8e6cc6 Mon Sep 17 00:00:00 2001 From: yoshiko2 Date: Tue, 19 Apr 2022 00:04:52 +0800 Subject: [PATCH] When the ```imagecut``` = 4, face recognition cuts the cover even with censored. --- ImageProcessing/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ImageProcessing/__init__.py b/ImageProcessing/__init__.py index 900ad55..3fd19f5 100644 --- a/ImageProcessing/__init__.py +++ b/ImageProcessing/__init__.py @@ -69,14 +69,18 @@ def cutImage(imagecut, path, fanart_path, poster_path, skip_facerec=False): imagecut = 1 elif conf.download_only_missing_images() and not file_not_exist_or_empty(fullpath_poster): return - if imagecut == 1: # 剪裁大封面 + # imagecut为4时同时也是有码影片 也用人脸识别裁剪封面 + if imagecut == 1 or imagecut == 4: # 剪裁大封面 try: img = Image.open(fullpath_fanart) width, height = img.size if width/height > 2/3: # 如果宽度大于2 - if skip_facerec: + if imagecut == 4: + # 以人像为中心切取 + img2 = img.crop(face_crop_width(fullpath_fanart, width, height)) + elif skip_facerec: # 有码封面默认靠右切 - img2 = img.crop((width - int(height/3) * aspect_ratio, 0, width, height)) + img2 = img.crop((width - int(height / 3) * aspect_ratio, 0, width, height)) else: # 以人像为中心切取 img2 = img.crop(face_crop_width(fullpath_fanart, width, height))