def _resize_thumbnail(self, image: TextIO, width: int, height: int) -> TextIO: img_format = image.format img = image.copy() img.thumbnail((width, height), Image.LANCZOS) img.format = img_format return img