Adding borders to an image using python

前端 未结 7 968
名媛妹妹
名媛妹妹 2020-11-29 05:10

I have a large number of images of a fixed size (say 500*500). I want to write a python script which will resize them to a fixed size (say 800*800) but will keep the origina

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 05:41

    ximg = Image.open(qpath)
    xwid,xhgt = func_ResizeImage(ximg)
    qpanel_3 = tk.Frame(Body,width=xwid+10,height=xhgt+10,bg='white',bd=5)
    ximg = ximg.resize((xwid,xhgt),Image.ANTIALIAS) 
    ximg = ImageTk.PhotoImage(ximg) 
    panel = tk.Label(qpanel_3,image=ximg)     
    panel.image = ximg 
    panel.grid(row = 2)
    

提交回复
热议问题