LoginSignup
10
7

More than 5 years have passed since last update.

pythonで画像の拡張子変換

Last updated at Posted at 2018-10-23

pythonを用いて画像処理を行う機会があったのですが,拡張子がバラバラで,使いたいライブラリに対応していない(特に.pdf)経験があり,わかりやすく変換できるものがあればなぁと思い,作ってみました.
スクリプト諸々はGithubにあげていますが,諸々不慣れですので,アドバイスいただけると幸いですm(_ _)m

実行環境

ubuntu 16.04
python 3.6.0

また,pythonモジュールとして
- Pillow(PIL)
- OpenCV
- pdf2image (https://github.com/Belval/pdf2image)
が必要になります.

ダウンロード

githubからとってくる.

git clone https://github.com/HisayaMiyao/image2image

実行方法

python image2image.py {対象画像が入ったディレクトリのパス} {変換前拡張子} {変換後拡張子}

#例
python image2image.py images_jpg .jpg .png

対応拡張子

.bmp .dib .eps .gif .hdr .ico .im .jp2 .jpe .jpeg .jpg .pbm .pcx .pdf .pgm .pic .png .pnm .ppm .pxm .ras .sgi .sr .tif .tiff .webp

10
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
7