[Image-SIG] [Tkinter-discuss] Possible to fade a small Tkinter image into a specific background color?

Edward Cannon edward at unicornschool.org
Thu Dec 9 07:22:26 CET 2010

using the blend function with a solid color image (bg color) and your
image will work, a simple loop changing the alpha value is all you
need. In my experience this is pretty fast. Check the documentation
for details.
Edward Cannon
Unicorn School

On Tue, Dec 7, 2010 at 5:07 AM, Wayne Werner <waynejwerner at gmail.com> wrote:
> On Mon, Dec 6, 2010 at 8:38 PM, <python at bdurham.com> wrote:
>> Wondering if there's a PIL/Tkinter technique I can use to fade a small image into a specific background color?
>> Use case: I have a small message area that displays both an icon and text message. I can fade my foreground text into its background container by iteratively moving my message text's rgb components towards its background rgb value until my text has the same foreground and background colors.
>> I'm wondering if there's a similar technique I can use with PIL and its Image, ImageTk classes to do the same with an image displayed in Tkinter? I suspect I can do this by inspecting and updating every pixel individually, but this seems very inefficent.
> Well, if you convert the image to a numpy array then you can call some C functions on it so it's not that slow. I'm not sure if any of the other PIL structures are natively C. Any type of fade operation you could call would be doing something on a per-pixel basis (even if the operations themselves are being performed in a very low-level language) anyway. This would just require you to implement it yourself.
> That's about the extent of my knowledge, there may be others with better ideas (or who can contradict mine!).
> HTH,
> Wayne
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig

More information about the Image-SIG mailing list