import Image import os if __name__ == "__main__": infile = raw_input('give me a file with path:') new_width = raw_input('give me the with you will convert:') # 200 new_width = float(new_width) img = Image.open(infile) img_size = img.size # PIL的size属性结构:(width, height) new_height = new_width * img_size[1] / img_size[0] new_image = img.resize((int(new_width), int(new_height))) new_image.save("%s/convert_%s" % (os.path.dirname(infile), os.path.basename(infile)))
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字
上传中....