logo
  • 教程列表
  • SO官方文檔
  • Pillow
    • 閱讀影象檔案
    • 將檔案轉換為 JPEG
  1. StackOverflow 文件
  2. Python Language 教程
  3. Pillow
  4. 將檔案轉換為 JPEG

將檔案轉換為 JPEG

Created: November-22, 2018

from __future__ import print_function
import os, sys
from PIL import Image

for infile in sys.argv[1:]:
    f, e = os.path.splitext(infile)
    outfile = f + ".jpg"
    if infile != outfile:
        try:
            Image.open(infile).save(outfile)
        except IOError:
            print("cannot convert", infile)
  • 閱讀影象檔案

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明