简体   繁体   中英

how to compress the size of the picture in django-summernote

tako的任务是如何压缩通过django-summernote上传的图像例如,我下载后的图片大小为5mb,应该大小为500kb

Edit the paths as you wish and choose one of the two when finished:

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM