Download: latest (1.8.0)

pymagery — python imagery


1.8.0 documentation / border plugin

The border plugin can add or remove an equally thick border around the entire image. If adding a border then it is necessary to supply the pixel value to use to fill in the new pixels. If a fill value is not supplied then black is assumed.

It is based on the canvasresize plugin.

The plugin prototype is:

def border(thickness, fillval=0)

The following example adds a 10-pixel white border. The image before and after the border are shown below (set against a red background to see the white border).

import pymagery i = pymagery.image('foo.ppm') i.border(10, (255<<16)+(255<<8)+255)

The following example removes a 10-pixel border (fill value is ignored):

import pymagery i = pymagery.image('foo.ppm') i.border(-10)

Change Log