質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

2回答

4135閲覧

PythonでPDFを画像に変換したい

jun_endo

総合スコア56

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2018/07/02 06:19

###pythonの各ページを画像に変換したい

今回、PDFの中の必要な情報を画像解析したいと考えております。
(機械学習の勉強の一環で都合により変換したい、そのため、変換した画像を機械学習にかける予定)

その中で、いろいろ探した結果、Popplerに行き着いたのですが、
対応OSにWindowsに対応していないためインストールできなかった。

$pip install python-poppler-qt4 Collecting python-poppler-qt4 Downloading https://files.pythonhosted.org/packages/94/72/20732d33836422ef07a7f0f86e452e2d236ab02626c71a66fb0302e3548e/python-poppler-qt4-0.24.0.tar.gz Complete output from command python setup.py egg_info: running egg_info creating pip-egg-info\python_poppler_qt4.egg-info writing dependency_links to pip-egg-info\python_poppler_qt4.egg-info\dependency_links.txt writing top-level names to pip-egg-info\python_poppler_qt4.egg-info\top_level.txt writing pip-egg-info\python_poppler_qt4.egg-info\PKG-INFO writing manifest file 'pip-egg-info\python_poppler_qt4.egg-info\SOURCES.txt' Unsupported Qt version (5.9.5). Try specifying the path to qmake manually via --qmake-bin= ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in C:\Users\ユーザー名\AppData\Local\Temp\pip-install-dd5pnygu\python-poppler-qt4\

ダメもとで挑戦した結果、上記の結果になり残念な結果となった。

代わりとなるモジュールを知っている方や、上記の解決方法など
何かわかることがありましたら教えてください。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

tachikoma

2018/07/02 06:32

qt5にすればエラー取れたりしないですかね。python-poppler-qt5
jun_endo

2018/07/02 06:37

pip install python-poppler-qt5 Collecting python-poppler-qt5 Using cached https://files.pythonhosted.org/packages/af/e7/aa451d4ca0910472c4442d8aa6ef44300852926d85ad033b029a22157027/python-poppler-qt5-0.24.2.tar.gz Building wheels for collected packages: python-poppler-qt5 Running setup.py bdist_wheel for python-poppler-qt5 ... error Complete output from command C:\Users\jun_endo\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\jun_endo\\AppData\\Local\\Temp\\pip-install-obf8k3cb\\python-poppler-qt5\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\jun_endo\AppData\Local\Temp\pip-wheel-k_jg9izm --python-tag cp35: running bdist_wheel running build running build_ext building 'popplerqt5' extension Can't determine version of poppler-qt5 C:/Users/jun_endo/AppData/Local/Continuum/anaconda3\Library\bin\sip.exe -I C:/Users/jun_endo/AppData/Local/Continuum/anaconda3\sip -t POPPLER_V0_20_0 -c build\temp.win-amd64-3.5\Release -b build\temp.win-amd64-3.5\Release\poppler-qt5.sbf -I C:/Users/jun_endo/AppData/Local/Continuum/anaconda3\sip\PyQt5 -t WS_WIN -t Qt_5_10_1 poppler-qt5.sip sip: Deprecation warning: poppler-qt5.sip:1: %Module version numbers are deprecated and ignored sip: QDomElement is undefined error: command 'C:/Users/jun_endo/AppData/Local/Continuum/anaconda3\\Library\\bin\\sip.exe' failed with exit status 1 ---------------------------------------- Failed building wheel for python-poppler-qt5 Running setup.py clean for python-poppler-qt5 Failed to build python-poppler-qt5 distributed 1.22.0 requires msgpack, which is not installed. Installing collected packages: python-poppler-qt5 Running setup.py install for python-poppler-qt5 ... error Complete output from command C:\Users\jun_endo\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\jun_endo\\AppData\\Local\\Temp\\pip-install-obf8k3cb\\python-poppler-qt5\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\jun_endo\AppData\Local\Temp\pip-record-rloooccr\install-record.txt --single-version-externally-managed --compile: running install running build running build_ext building 'popplerqt5' extension Can't determine version of poppler-qt5 C:/Users/jun_endo/AppData/Local/Continuum/anaconda3\Library\bin\sip.exe -I C:/Users/jun_endo/AppData/Local/Continuum/anaconda3\sip -t POPPLER_V0_20_0 -c build\temp.win-amd64-3.5\Release -b build\temp.win-amd64-3.5\Release\poppler-qt5.sbf -I C:/Users/jun_endo/AppData/Local/Continuum/anaconda3\sip\PyQt5 -t WS_WIN -t Qt_5_10_1 poppler-qt5.sip sip: Deprecation warning: poppler-qt5.sip:1: %Module version numbers are deprecated and ignored sip: QDomElement is undefined error: command 'C:/Users/jun_endo/AppData/Local/Continuum/anaconda3\\Library\\bin\\sip.exe' failed with exit status 1 ---------------------------------------- Command "C:\Users\jun_endo\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\jun_endo\\AppData\\Local\\Temp\\pip-install-obf8k3cb\\python-poppler-qt5\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\jun_endo\AppData\Local\Temp\pip-record-rloooccr\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\jun_endo\AppData\Local\Temp\pip-install-obf8k3cb\python-poppler-qt5\
jun_endo

2018/07/02 06:38

このようになりました。醜くてすいません。ちなみに環境はAnacondaを使用しております。
guest

回答2

0

ベストアンサー

コマンドからPDFBOXのExtractImagesを使って画像に変換する方法はどうですか

https://pdfbox.apache.org/2.0/commandline.html

python

1cmd = 'java -jar pdfbox-app-2.0.11.jar ExtractImages {}'.format(filename) 2args = shlex.split(cmd) 3p = subprocess.Popen(args) 4 5p.wait()

投稿2018/07/02 15:36

barobaro

総合スコア1286

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

Pythonと関係ありませんがGhostScriptを調べてみると幸せになれると思います。

投稿2018/07/02 06:24

YouheiSakurai

総合スコア6142

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問