繁体   English   中英

如何去除图片中的白边?

[英]How to remove white borders from images?

如何删除自定义图像上的白色边框?

注意:澄清这不仅仅是按钮问题,因为圆圈是具有相同问题的背景图像。

这些是用透明背景导出的,所以我不明白白色边框。

from tkinter import *
import tkinter as tk
import random

window = tk.Tk()

window.option_add('font', 'Impact 19')

window.title("Randomizer")

window.geometry("600x900")

back =Canvas(window, bg="#172E38", height=2000, width=1000)


# ----RANDOM SELECT GEN--------
def random_gen():
    Champ = ['Aatrox',
             'Zoe']
    Lane = ['top', 'bottom', 'middle', 'support', 'jungle']
    Build = ['AD', 'Tank', 'AP', 'Crit', 'Attack speed', 'Assassin']

    x = random.choice(Build)
    y = random.choice(Champ)
    z = random.choice(Lane)

    return (x, y, z)


# TEST FUNCTION-------------
def random_display():
    result = random_gen()
    label.config(text=result, bg="#172E38", fg="#C49E4E", font=1000)


# Background----------------

C = Canvas(window, borderwidth=0)
filename = PhotoImage(file="C:/Users/wrped/OneDrive/Desktop/button44-01.png")
background_label = Label(window, image=filename)
background_label.place(x=25, y=174)

# -----BUTTON---------------


label = Label(window, text="", font=1000, height=1, width=41, bg="#172E38")
label.place(x=120, y=425)

button = tk.Button(text="Goodluck!", command=random_display, font=500, borderwidth=-5, relief=FLAT)
img = PhotoImage(file="C:/Users/wrped/OneDrive/Desktop/button1t-01.png")
button.config(image=img)
button.place(x=188, y=613)

button = tk.Button(command=window.quit, borderwidth=0)
exit = PhotoImage(file="C:/Users/wrped/OneDrive/Desktop/exit-01.png")
button.config(image=exit)
button.place(x=228, y=690)

C.place(x=200, y=200)

back.pack()


window.mainloop()

PS我是新来的我不知道该怎么做这很容易解释我可以用大量的文字来描述它并且它不会让我发布因为代码太多 - 所以如果有人可以给我提示以后的帖子会很棒!

您可以使用 Adob​​e Photoshop 轻松去除图像中的白色边框。 我不想重新发明轮子所以你可以去这里,或者你也可以使用这个边框编辑软件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM