Skip to content
Browse files

Add Image.border() method

  • Loading branch information
euphoris authored and dahlia committed Dec 30, 2012
1 parent 81ad634 commit 2496d37f75d75e9425f95dde07033217dc8afefc
Showing with 27 additions and 0 deletions.
  1. +3 −0 wand/
  2. +24 −0 wand/
@@ -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]
@@ -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()

0 comments on commit 2496d37

Please sign in to comment.