Create JPEG thumbnails
from __future__ import print_function
import os, sys
from PIL import Image
size = (128, 128)
for infile in sys.argv[1:]:
outfile = os.path.splitext(infile)[0] + ".thumbnail"
if infile != outfile:
try:
im = Image.open(infile)
im.thumbnail(size)
im.save(outfile, "JPEG")
except IOError:
print("cannot create thumbnail for", infile)
반응형
'lang > py' 카테고리의 다른 글
library Tesseract - OCR test (0) | 2019.01.25 |
---|---|
library Tesseract - OCR (0) | 2019.01.24 |
library requests - HTTPBasicAuth (0) | 2019.01.22 |
library requests - cookie, session, login (0) | 2019.01.21 |
requests file upload (0) | 2019.01.20 |