0

I am a beginner in Python and here is my problem.

I get an image from an url and I want to resize it before saving (copy) it to my server.

Here is my current (not working) code:

urlImage = urllib2.urlopen(URL)
img = Image.open(urlImage)
imgResize = img.resize((weight, height), Image.ANTIALIAS)
os.system("scp -r %s MYSERVER" % (imgResize))

I'm getting this error:

sh: 1: cannot open PIL.Image.Image: No such file

I'm guessing that the problem is that imgResize is not a path (string) but an object and so my os.system call is building up a string that expects a path.

Any solution on how to resolve this problem ?

0 Answers0