[Image-SIG] PIL and out-of-bounds crop-coordinates

Markus Meyer meyer at mesw.de
Tue Jun 22 10:09:16 EDT 2004

Hi everyone,

I'm using PIL 1.1.4 (on Linux and Windows) to do some extensive cropping
of images. I often have out-of-bounds crop parameters, e.g. say I have a
100x100 image and want to "crop" the image using the rect
(10,10,150,150). With these parameters, part of the image at the upper
left corner is cropped, but at the lower right corner, empty space is
added. Tests have shown that PIL does this correctly, but (not
surprisingly) adds random stuff at the "empty" places.

Is this use of crop legitimate? Can I be sure that no segmentation
faults or other exceptions occur when using crop this way? If yes, how
can I tell PIL which background it should use for the empty parts of the
newly created picture? If not, what simple solution would you suggest as

Thanks in advance


More information about the Image-SIG mailing list