简体   繁体   English

如何在没有PIL的情况下使图像的背景显得透明?

[英]How can I make the background of an image appear transparent without PIL?

I'm trying to make a GUI in tkinter that uses one image as an overlay on top of another, but when I place the image over the lower one, the transparent area of the image appears as grey. 我正在尝试在tkinter中制作一个GUI,该GUI使用一个图像作为另一个图像的叠加,但是当我将图像放置在较低图像之上时,图像的透明区域显示为灰色。

I've searched for solutions to this, but all the results that I've found have pointed towards using PIL. 我一直在寻找解决方案,但是所有发现的结果都指向使用PIL。

Is it possible for me to use transparent, or partially transparent images in the python tkinter module without using PIL ? 我可以在不使用PIL的情况下在python tkinter模块中使用透明或部分透明的图像吗?

You could use some basic photoshop tools like the magic wand tool to remove the background, but keep in mind, some PNG format images have a faint background. 您可以使用一些基本的photoshop工具(例如魔术棒工具)删除背景,但是请记住,某些PNG格式的图像背景较暗。 This is either in the from of a watermark, or the image background was rendered with a lower opacity than the rest of the image. 这要么是水印的开始,要么是图像背景的不透明度低于其余图像。 Your GUI may also have a layer placed above the images by default. 默认情况下,您的GUI可能还会在图像上方放置一层。 Does it appear on each image seperatly when loaded into the GUI? 加载到GUI中时,它是否分别出现在每个图像上?

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

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