"AFFINE" python PIL not defined

I use the conversion method of the Image class.

import Image im = Image.open('Image.jpg') im1 = im.transform((1000,1000),AFFINE, (1,0,0,1,10,10)) 

The above code causes an error: NameError: the name "AFFINE" is not defined. If I use "from Image import *", it works:

 from Image import * im = open('Image.jpg') im1 = im.transform((1000,1000),AFFINE, (1,0,0,1,10,10)) 

However, I do not want to override my previously defined methods, so I want to use "import Image". How can I make my first example without using "from Image import"?

+4
source share
1 answer

Use im1 = im.transform((1000,1000),Image.AFFINE, (1,0,0,1,10,10)) the variable prefix with the module name.

+7
source

All Articles