How to crop from one image and paste into another with PIL?
A PIL crop box is defined as a 4-tuple of pixel coordinates: (left, upper, right, lower)
.
To fix your code to get a 30x30 crop:
box = (70, 70, 100, 100)
Broken down into components:
x, y, w, h = (70, 70, 30, 30)
box = (x, y, x + w, y + h)
For future visitors: this error may also come up if the box
argument to paste
contains float
s instead of int
s.