Инструмент Convert может выполнить эту работу:
Код: Выделить всё
$ convert test.pdf test.png
$ file test.png
test.png: PNG image data, 595 x 842, 8-bit gray+alpha, non-interlaced
Код: Выделить всё
import pdf2image
with open("test.pdf", "rb") as fd:
pdf = pdf2image.convert_from_bytes(fd.read(), transparent=True)
pdf[0].save("test.png")
Код: Выделить всё
$ python test.py
$ file test.png
test.png: PNG image data, 1654 x 2339, 8-bit/color RGB, non-interlaced
Подробнее здесь: https://stackoverflow.com/questions/793 ... ansparency
Мобильная версия