Crop image from URL

Hi,

I’m trying to crop the image from URL. I’ve downloaded the PIL library from here (http://www.pythonware.com/products/pil) and put it under Shared folder. Here is the section of my codes to crop the image. Any Python expert can comment the error?

    from PIL import Image

    img_file = urllib2.urlopen(posterUrl)
    im = StringIO(img_file.read())
    width, height = im.size

    left = width / 2
    top = 0
    right = width
    bottom = height

    im1 = im.crop(left, top, right, bottom)

    metadata.posters["Main"] = im1

Thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.