PIL transparency gradient

SPE - Stani's Python Editor spe.stani.be at gmail.com
Sat Mar 1 22:37:32 CET 2008

On 1 mrt, 22:04, Allard Warrink <allardwarr... at gmail.com> wrote:
> I would like to create a transparency gradient over an image using
> PIL. But I don't have a clue how to do this...
> Is there anyone out here who could give me some advise?

Phatch (PHoto & bATCH) is an application based on PIL. Its actions
contain many useful PIL recipes, such as applying a transparency
gradient to an image. You basically need to create an 1pxx256px
grayscale image which goes from 0 to 255. After that you can stretch
it to the image size and add it as an alpha channel. You'll find the
source code for this in the phatch/actions/mask.py Every action
contains a 'raw' PIL function that can work independently outside the
context of Phatch. This is by design, inspired by the MVC model in
which you could see PIL as the model and Phatch as the View.

You can get Phatch at:

Read first *carefully* the installation instructions for your


More information about the Python-list mailing list