Python (Imaging library): Resample string as argument

python, python-imaging-library

Solution

Well, then Image.ANTIALIAS is not a string, so don't treat it as one:

scaler = Image.ANTIALIAS

Problem

Python beginner question. Code below should explain my problem: ``` import Image resolution = (200,500) scaler = "Image.ANTIALIAS" im = Image.open("/home/user/Photos/DSC00320.JPG") im.resize(resolution , scaler) ``` RESULT: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1255, in resize raise ValueError("unknown resampling filter") ValueError: unknown resampling filter ``` This one works: ``` im.resize(resolution , Image.ANTIALIAS) ```

Original source