Notice
Recent Posts
Recent Comments
Link
목록jpeg (2)
아미(아름다운미소)
JPEG 섬네일 생성하기
JPEG 섬네일 생성하기 import os, sys 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
랭귀지/python
2018. 6. 4. 09:00
Python 파일을 JPEG으로 변환하기
파일을 JPEG으로 변환하기 import os, sys 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 splitext(p) pathname에서 확장자를 분리합니다. 확장자는 점(.) 뒤에 있는 텍스트 입니다. "(root, ext)"를 반환하고, ext는 비어 있을 수도 있습니다. 두..
랭귀지/python
2018. 6. 3. 21:39