[Image-SIG] assigning commands to a variable

francesco francesco.pirotti at unipd.it
Tue Aug 24 17:16:21 CEST 2004


Hi,
is it possible to assign a string to a variable and then make python 
understand that it is not just text but a command?

The actual problem is that I want to use the PIL filters, which are called

<myimage>.filter(ImageFilter.<filter_type>)

filter_type can be a number of different filter types, like for example 
"BLUR" or "SMOOTH".
My user chooses the filter type and then I have to put it in the function

a = "BLUR"
and then

<myimage>.filter(ImageFilter.a)

but of course that does not work, as "a" is not recognized as a ImageFilter 
module and also assigning

a = "ImageFilter.BLUR"

does not work.  Is there a trick? (I am obviously not an ace as programmer)


Thank you,
Francesco Pirotti 



More information about the Image-SIG mailing list