Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
tako 的任务是如何压缩通过 django-summernote 上传的图片 例如,我有一张 5mb 大小的图片,下载后它应该有 500kb 的大小
根据需要编辑路径,并在完成后选择两者之一:
from PIL import Image foo = Image.open("path to image") foo = foo.resize((720, 405), Image.ANTIALIAS) foo.save("path to first new image", quality=95) foo.save("path to second new image", optimize=True, quality=95)