Skip to content

Commit 33cd1d7

Browse files
committedNov 16, 2024
enforce RGB color format for face image
1 parent 3f784ce commit 33cd1d7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎pix/task/facedetect.py

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def main(
3939
def save_face_images(image: Image, faces: List[Face], images_dir: Path, face_images_dir: Path):
4040
filenames = []
4141
with PILImage.open(images_dir / image.local_filename) as im:
42+
if im.mode != 'RGB':
43+
im = im.convert('RGB')
44+
4245
for i, face in enumerate(faces):
4346
filename = f"{image.id}.{i}.jpg"
4447
face_im = im.crop((face.x, face.y, face.x + face.width, face.y + face.height))

0 commit comments

Comments
 (0)
Please sign in to comment.