Mask two images with python

ant ant at
Fri Dec 21 09:27:12 EST 2018

Umar Yusuf wrote:
> Hello Oscar,
> Thank you for your time.. Here is attached is an example set of the images: basically, it is "design + mask and glow = result"

  that didn't work for me at all...

  are the images .png or some other format that
allows transparency?

  is it critical that it be done via Python or do you
just want it done at all?  :)

  gimp and other tools (Graphics Magic) will allow 
this to be done interactively or via the command 

  if it has to be done in python i'm only familiar
with pyglet and could do it easily enough that way
(sorry i'm a newbie about other ways in python :) ).

make a sprite in a certain location in a window with
the background image and then make another sprite with
the next layer on top of that one, one at a time, each
with it's own batch id.

then when it appears how you like it you can grab a
screen shot via:

The following example shows how to grab a screenshot of your application window:


Note that images can only be saved in the PNG format unless the Pillow library is installed.

  if you want an example of multiple layers i have
my work in progress that does exactly this sort of 
thing (except i never save an image yet - that could
be easily added as above).  you're welcome to take
the code and use it however you like:


More information about the Python-list mailing list