Re: How to pad image in PythonMagick (or *Magick)?
Posted: 2009-03-12T13:12:16-07:00
Hi Jerry,
I haven't tried using PythonMagick yet, but if you are interested, here is how you can do it using PHP:
Padding add of the sides, or both top & bottom or left & right is pretty straight-forward. To pad just one corner however is a little tricker: you have to first
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.
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.