def _crop_center(self, pil_img: TextIO, crop_width: int, crop_height: int) -> TextIO: img_width, img_height = pil_img.size return pil_img.crop( ((img_width - crop_width) // 2, (img_height - crop_height) // 2, (img_width + crop_width) // 2, (img_height + crop_height) // 2))