6

I'm working with satellites images and i need to select one part of the image to work if. How can i do it? Im.crop doesn't seen to work. Resize?

Thanks

1 Answers1

11
from PIL import Image
im = Image.open("test.jpg")

crop_rectangle = (50, 50, 200, 200)
cropped_im = im.crop(crop_rectangle)

cropped_im.show()

Note that the crop region must be given as a 4-tuple - (left, upper, right, lower).

More details here Using the Image Class

chunjy92
  • 39
  • 7
symmetry
  • 469
  • 3
  • 5
  • I did exactly that, but the answer is: "'Numpy.ndarray' object has no attribut 'crop'. that's my doubt. What do i do now? – Carlos Pinto da Silva Neto Jun 30 '11 at 11:44
  • That means you are trying to apply a crop method to a Numpy.ndarray instance but it doesn't have a crop method. Make sure you are applying the crop method to an instance of PIL's Image class. If you still can't get it working, post your code. – symmetry Jun 30 '11 at 16:59