推荐学习书目
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
liuxu
V2EX  ›  Python

怎么用 Python 将 pdf, doc 等转换成 jpg

  •  
  •   liuxu · Aug 7, 2015 · 8576 views
    This topic created in 3946 days ago, the information mentioned may be changed or developed.
    查看的python-uno和imagemagick实例,都只是转换了文档第一页,怎么把全部页面转换成jpg呢?
    3 replies    2015-08-07 16:41:47 +08:00
    eriale
        2
    eriale  
       Aug 7, 2015   ❤️ 1
    我是先把doc转换成pdf,然后再转jpg。
    你可以用Wand(http://docs.wand-py.org/en/0.4.1/)来转:
    from wand.image import Image

    with Image(filename='filename.pdf') as pdf:
    with pdf.convert('jpeg') as image:
    image.save(filename='result.jpeg')
    gully
        3
    gully  
       Aug 7, 2015
    使用过好几个, 最靠谱的是基于 mupdf 的 Python 绑定: https://github.com/rk700/PyMuPDF

    demo: https://github.com/rk700/PyMuPDF/blob/master/demo/demo.py
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2663 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 57ms · UTC 15:47 · PVG 23:47 · LAX 08:47 · JFK 11:47
    ♥ Do have faith in what you're doing.