Skip to content

Commit 398e32e

Browse files
committed
complete 0005
1 parent e9c4c50 commit 398e32e

File tree

9 files changed

+32
-0
lines changed

9 files changed

+32
-0
lines changed

Jimmy66/0005/0005.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
#随便查了下为iphone5的分辨率为1136x640像素,因为自己也不用,所以不清楚,也懒得具体求证了
5+
6+
#导入模块,顺便一提我在OS X 环境下用的是pillow,直接pip安装PIL老是出错,希望能帮到遇到同样问题的人
7+
from PIL import Image
8+
import glob
9+
10+
#得到当前目录下的图片文件列表
11+
def get_list():
12+
return glob.glob('*.jpg')
13+
14+
#图像处理
15+
def image_process(imagename,number):
16+
im = Image.open(imagename)
17+
im2 = im.resize((1136,640))
18+
number = str(number)
19+
im2.save('./'+number+'.jpg', 'jpeg')
20+
21+
#主函数,循环遍历图像列表进行处理
22+
def main():
23+
imagelist = get_list()
24+
n = 1
25+
for name in imagelist:
26+
image_process(name,n)
27+
n += 1
28+
29+
30+
if __name__ == '__main__':
31+
main()
32+

Jimmy66/0005/1.jpg

128 KB
Loading

Jimmy66/0005/2.jpg

107 KB
Loading

Jimmy66/0005/3.jpg

82.8 KB
Loading

Jimmy66/0005/4.jpg

134 KB
Loading
Loading
625 KB
Loading

Jimmy66/0005/bg6.jpg

1.73 MB
Loading

Jimmy66/0005/maxresdefault.jpg

191 KB
Loading

0 commit comments

Comments
 (0)