[Image-SIG] Creating a Transparent Image and Placing it Over Another Image (txt)

Wayne Watson sierra_mtnview at sbcglobal.net
Tue Apr 7 16:32:23 CEST 2009

Christopher Barker wrote:
> Wayne Watson wrote:
>> Drawing on top of an image doesn't seem like it's going to help much 
>> if I want the user to move the circle-crosshair with his mouse.
> I think we need a little more detail about what you need here:
> Is the cross-hair there for the user to indicate the location of 
> something while using the program, or do you want to be able to save 
> it out as part of a final product image?
Exactly the former. Once the user is happy, then clicking the mouse 
should indicate the x,y pixels he needs for a computation.
> In either case, actually, you do have two choices: it could be a 
> transparent image, or it could be created by "vector" drawing 
> functions, something like one DrawCircle and two DrawLine calls. (what 
> exactly they will be depends on the toolkit)
Tkinter is all I will consider presently.
> >and PhotoShop. The ideas are the same as PIL in that layers correspond
>> to a PIL modes, and bands are sub-layers that contain R,B,G, A. In 
>> PSP, one piles a transparency on top of another layer. In PIL land it 
>> seems like, according to the example, one pastes into the layer.
> I don't think that PIL has the concept of layers, but rather 
> individual images -- you'll have to manage them as layers
Yes, PIL does not use the term layer, unfortunately. BTW, look at my 
post higher up in the thread. A simple change in the web example program 
produced a transparency as one might expect.
> yourself. But yes, paste() is the method to draw one image on top of 
> another. It also may or may not make sense to use your GUI toolkit 
> drawing capabilities, rather than PIL, to composite the layers. I 
> probably would with wx -- I don't know about TK.
>> Something that may be instructive on these needs is Grayson's book on 
>> Tkinter, which has a few chapters on the web. He provides all the 
>> examples, and one chapter of his book is a drawing program that uses 
>> rubberband effects, and moving objects on the canvas--
The download of Pmw left me the lurch for now. There's a part of the 
install process that is not explained for Win. I sent the host (a 
person) a msg. Although, I've heard on another list that Pmw is nearly 
dead it doesn't look that way to me. The posts and updates there look 
quite current.
> And that's all using the TK Canvas features -- I think. I was thinking 
> that your cross hairs are more analogous to a "rubber band" box.
>> As for xpPython, I know little about it. I'm working with a 2000+ 
>> line program written by someone else that uses Tkinter. I'm adding 
>> new features to it, and  not so sure it's wise to go off onto some 
>> other form of Python or toolkits without understanding what I've 
>> really got.
> TK is quite capable, I mentioned wx, 'cause I know it well -- you can 
> google around to get a sense of the strengths of the toolkits, if you 
> are considering a change, but I don't imagine you can't use TK for this.
Maybe Tk is not usable here, but I'd like to know definitely one way or 
the other. Canvas has create items like polygons, and arcs. I see that 
each has a transparency of some sort. It's not obvious what that's about.
> -Chris


           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)****

          "Less than all cannot satisfy Man." -- William Blake

More information about the Image-SIG mailing list