I haven't tried using PythonMagick yet, but if you are interested, here is how you can do it using PHP:
Code: Select all
<?php
// e.g. Pad left and right with 100px white bg
$im = new Imagick("myImage.png");
$white = new ImagickPixel( "white" );
$im->borderImage($white, 100, 0);
$im->writeImage("output.png");
?>
pad all sides, then remove the padding (via cropImage) that you don't want.
Check out the IMagick Docs for more info if you are interested.
Hope this helps.