Download: latest (1.8.0)

pymagery — python imagery


1.5.0 documentation / crop plugin

The crop plugin crops the image down from the full size to whatever bounding box is specified. This plugin is similar to the canvasresize plugin except that it performs more boundary box checks.

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')

Change Log