Did I find the right examples for you? yes no

All Samples(29)  |  Call(25)  |  Derive(0)  |  Import(4)
Add border to the image

:param image: The image to expand.
:param border: Border width, in pixels.
:param fill: Pixel fill value (a color value).  Default is 0 (black).
:return: An image.

        def expand(image, border=0, fill=0):
    """
    Add border to the image

    :param image: The image to expand.
    :param border: Border width, in pixels.
    :param fill: Pixel fill value (a color value).  Default is 0 (black).
    :return: An image.
    """
    "Add border to image"
    left, top, right, bottom = _border(border)
    width = left + image.size[0] + right
    height = top + image.size[1] + bottom
    out = Image.new(image.mode, (width, height), _color(fill, image.mode))
    out.paste(image, (left, top))
    return out
        


src/n/i/nimfa-1.0/nimfa/examples/orl_images.py   nimfa(Download)
try:
    from PIL.Image import open, fromarray, new
    from PIL.ImageOps import expand
except ImportError, exc:
    raise SystemExit("PIL must be installed to run this example.")
            basis = 255 - basis
            ima = fromarray(basis)
            expand(ima, border = 1, fill = 'black')
            blank.paste(ima.copy(), (j * 46 + j, i * 56 + i))
    imshow(blank)

src/n/i/nimfa-1.0/nimfa/examples/cbcl_images.py   nimfa(Download)
try:
    from PIL.Image import open, fromarray, new
    from PIL.ImageOps import expand
except ImportError, exc:
    raise SystemExit("PIL must be installed to run this example.")
            ima = fromarray(basis)
            ima = ima.rotate(180)
            expand(ima, border = 1, fill = 'black')
            blank.paste(ima.copy(), (j * 19 + j, i * 19 + i))
    imshow(blank)

src/m/f/MF-HEAD/nimfa/examples/orl_images.py   MF(Download)
try:
    from PIL.Image import open, fromarray, new
    from PIL.ImageOps import expand
except ImportError, exc:
    warn("PIL must be installed to run ORL images example.")
            basis = 255 - basis
            ima = fromarray(basis)
            expand(ima, border=1, fill='black')
            blank.paste(ima.copy(), (j * 46 + j, i * 56 + i))
    imshow(blank)

src/m/f/MF-HEAD/nimfa/examples/cbcl_images.py   MF(Download)
try:
    from PIL.Image import open, fromarray, new
    from PIL.ImageOps import expand
except ImportError, exc:
    warn("PIL must be installed to run CBCL images example.")
            ima = fromarray(basis)
            ima = ima.rotate(180)
            expand(ima, border=1, fill='black')
            blank.paste(ima.copy(), (j * 19 + j, i * 19 + i))
    imshow(blank)

src/k/c/kcc-HEAD/kcc/image.py   kcc(Download)
            if self.image.size[0] <= self.size[0] and self.image.size[1] <= self.size[1]:
                self.noPV = True
            self.image = ImageOps.expand(self.image, border=(borderw, borderh), fill=fill)
            # Border can't be float so sometimes image might be 1px too small/large
            if self.image.size[0] != size[0] or self.image.size[1] != size[1]:
        if (float(self.image.size[0]) / float(self.image.size[1])) < ratioDev:
            diff = int(self.image.size[1] * ratioDev) - self.image.size[0]
            self.image = ImageOps.expand(self.image, border=(int(diff / 2), 0), fill=fill)
        elif (float(self.image.size[0]) / float(self.image.size[1])) > ratioDev:
            diff = int(self.image.size[0] / ratioDev) - self.image.size[1]
            self.image = ImageOps.expand(self.image, border=(0, int(diff / 2)), fill=fill)

src/l/o/localground-HEAD/apps/site/models/photo.py   localground(Download)
                im.thumbnail((s*2,s*2), Image.ANTIALIAS)
                im = im.crop([0,0,s-2,s-2])
                im = ImageOps.expand(im, border=2, fill=(255,255,255,255))
            else:
                im.thumbnail((s,s), Image.ANTIALIAS)
                im.thumbnail((s*2,s*2), Image.ANTIALIAS)
                im = im.crop([0,0,s-2,s-2])
                im = ImageOps.expand(im, border=2, fill=(255,255,255,255))
            else:
                im.thumbnail((s,s), Image.ANTIALIAS)

src/n/u/nupic-HEAD/py/nupic/image/__init__.py   nupic(Download)
    mask = bwImage
  else:
    bwImage = ImageOps.expand(bwImage, 1, fill=0)
    maskColor = 128
    ImageDraw.floodfill(bwImage, (0,0), maskColor)

src/g/e/geocamUtil-0.1/geocamUtil/icons/halo.py   geocamUtil(Download)
    n = max(im.size)
    widthPixels = int(n * width)
    padded = ImageOps.expand(im, border=3 * widthPixels)
    _, _, _, paddedA = padded.split()
 

src/g/e/geocamUtilWeb-HEAD/geocamUtil/icons/halo.py   geocamUtilWeb(Download)
    n = max(im.size)
    widthPixels = int(n * width)
    padded = ImageOps.expand(im, border=3 * widthPixels)
    _, _, _, paddedA = padded.split()
 

src/m/c/mcomix-HEAD/mcomix/histogram.py   mcomix(Download)
        draw.rectangle((0, 0, len(maxstr) * 6 + 2, 10), fill=(30, 30, 30))
        draw.text((2, 0), maxstr, fill=(255, 255, 255))
    im = ImageOps.expand(im, 1, (80, 80, 80))
    im = ImageOps.expand(im, 1, (0, 0, 0))
    return image_tools.pil_to_pixbuf(im)

  1 | 2  Next