Skip to content


Browse files Browse the repository at this point in the history
Add Image.border() method
  • Loading branch information
euphoris authored and dahlia committed Dec 30, 2012
1 parent 81ad634 commit 2496d37
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wand/
Expand Up @@ -274,6 +274,9 @@ class MagickPixelPacket(ctypes.Structure):
library.MagickRotateImage.argtypes = [ctypes.c_void_p, ctypes.c_void_p,

library.MagickBorderImage.argtypes = [ctypes.c_void_p, ctypes.c_void_p,
ctypes.c_size_t, ctypes.c_size_t]

library.MagickResetIterator.argtypes = [ctypes.c_void_p]

library.MagickIdentifyImage.argtypes = [ctypes.c_void_p]
Expand Down
24 changes: 24 additions & 0 deletions wand/
Expand Up @@ -1547,6 +1547,30 @@ def trim(self):
if not result:

def border(image, color, width, height):
"""Surrounds the image with a border.
:param image: the wand image
:type image: :class:`Image`
:param bordercolor: the border color pixel wand
:type image: :class:`~wand.color.Color`
:param width: the border width
:type width: :class:`numbers.Integral`
:param height: the border height
:type height: :class:`numbers.Integral`
.. versionadded:: 0.3.0
if not isinstance(color, Color):
raise TypeError('color must be a wand.color.Color object, not ' +
with color:
result = library.MagickBorderImage(image.wand, color.resource,
width, height)
if not result:

def _repr_png_(self):
with self.convert('png') as cloned:
return cloned.make_blob()
Expand Down

0 comments on commit 2496d37

Please sign in to comment.