bufsize is already increased to MAXBLOCK in ImageFile._save()

This commit is contained in:
Andrew Murray 2023-08-19 12:37:00 +10:00
parent 9242944526
commit a04ba81e22

View File

@ -800,7 +800,7 @@ def _save(im, fp, filename):
# The EXIF info needs to be written as one block, + APP1, + one spare byte.
# Ensure that our buffer is big enough. Same with the icc_profile block.
bufsize = max(ImageFile.MAXBLOCK, bufsize, len(exif) + 5, len(extra) + 1)
bufsize = max(bufsize, len(exif) + 5, len(extra) + 1)
ImageFile._save(im, fp, [("jpeg", (0, 0) + im.size, 0, rawmode)], bufsize)