[Image-SIG] Creating a Transparent Image and Placing it Over Another Image (txt)
Chris.Barker at noaa.gov
Tue Apr 7 16:04:05 CEST 2009
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?
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)
>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 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--
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.
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the Image-SIG