V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
xpyusrs
V2EX  ›  Python

PIL 库打开图片保存为 pdf,转的 pdf 文件超级大, 怎么解决

  •  
  •   xpyusrs · 2022-08-05 22:03:18 +08:00 · 1852 次点击
    这是一个创建于 622 天前的主题,其中的信息可能已经有所发展或是发生改变。
    from PIL import Image, ImageFile
    newImg = Image.open('test.gif')
    newImg.save('1111.pdf')
    

    我就打开一个 63kb 的图片, 存成 pdf 文件居然有 21MB 这么大, 大佬们帮帮忙

    3 条回复    2022-08-07 15:50:50 +08:00
    robotdiy
        1
    robotdiy  
       2022-08-06 11:14:08 +08:00
    21m 有点过分啊。
    cz5424
        2
    cz5424  
       2022-08-06 16:51:47 +08:00
    一般 pillow save 后面有参数可以加,查一下文档,像 jpeg 可以调质量
    raycool
        3
    raycool  
       2022-08-07 15:50:50 +08:00
    有 resolution 参数
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3194 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 10:50 · PVG 18:50 · LAX 03:50 · JFK 06:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.