1. 程式人生 > >圖片拉伸,改變長寬比

圖片拉伸,改變長寬比

bsp anti resize imp nbsp 拉伸 cpp port res

圖片拉伸,改變長寬比

from PIL import Image
logo=‘fugu.png‘
mid_icon = Image.open(logo)
mid_icon_w, mid_icon_h = mid_icon.size
mid_factor = 5
mid_icon_w, mid_icon_h = mid_icon_w * mid_factor, mid_icon_h * mid_factor
mid_icon = mid_icon.resize((mid_icon_w*33, mid_icon_h), Image.ANTIALIAS)
mid_icon.save(‘fugu.2.png‘,‘PNG‘)

  

圖片拉伸,改變長寬比