Download: latest (1.8.0)

pymagery — python imagery


1.0.0 documentation / crop plugin

The crop plugin crops the image down from the full size to whatever bounding box is specified. The plugin prototype is:

def crop(width, height, left=0, top=0)

As usual, the top-left corner marks the origin of the image thus the default top-left corner of the crop box is the image origin. As a matter of convenience, the crop box is allowed to exceed the image boundary.

The following example trims off a pixel border for the entire image:

import pymagery i = pymagery.image('foo.ppm') i.crop(i.width-2, i.height-2, 1, 1) i.save('bar.ppm')