看世界
 
昨日:篇  今日:篇   总帖:篇   会员:
admin
创始人Lv2   
图片 尺寸分类     
# coding: utf8  
from PIL import Image
import os, sys
import shutil


path = "z:\\new\\"
filename = 2
img = Image.open("z:\\{}.gif ".format(filename))  
w =  img.size[0]
h = img.size[1]
if w > h:
    print "横型图片"
    path1 = "z:\\new\\1\\"
    shutil.copy("z:\\{}.jpg".format(filename),path1)
    
elif w == h:
    
    print '正方形图片'
    path2 = "z:\\new\\2\\"
    shutil.copy("z:\\{}.gif ".format(filename),path2)
    
    
else:
    print "竖型图片"
   
    path3 = "z:\\new\\3\\"
    shutil.copy("z:\\{}.PNG|.jpg ".format(filename),path3)

 0  已被阅读了37次  楼主 2018-10-18 23:07:52
回复列表

回复:图片 尺寸分类

LOOK官方站 联系站长
Powered by Look博客