PadImage - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

ImageTools

 PadImage
 pad an image to make it larger

 Calling Sequence PadImage( img, height, width, opts )

Parameters

 img - Image; input image height - (optional) range(integer); desired vertical index range width - (optional) range(integer); desired horizontal index range opts - (optional) equation(s) of the form option = value; specify options for the PadImage command

Options

 • bottom = nonnegint
 If specified, sets the width of the padding on the bottom edge.
 • border = nonnegint
 Specifies the width of the padding around any otherwise unspecified edges. The default is 0.
 • fill = numeric, list(numeric), reflect, replicate
 Specifies how to fill the padding. If numeric, then that value is inserted everywhere. If a list of numeric values, then each layer of a color image is filled with the appropriate value in the list. If reflect is specified, then the image is reflected into the padding. If replicate is specified, then the edge values are extended into the padding. The default is 0.
 • left = nonnegint
 If specified, sets the width of the padding on the left edge.
 • right = nonnegint
 If specified, sets the width of the padding on the right edge.
 • top = nonnegint
 If specified, sets the width of the padding on the top edge.
 • reindex = truefalse
 If true then the indices of the returned image are reindexed so that they start at 1. The default is false.

Description

 • The PadImage command increases the size of an image by adding padding around its edges.
 • The img parameter must be of type Image.
 • The optional height and width parameters specify the range of indices for the height and width of the padded image. The padded dimensions must be larger than the original dimensions. These override other dimension settings (border, top, etc.).

Examples

 > $\mathrm{with}\left(\mathrm{ImageTools}\right):$
 > $\mathrm{img}≔\mathrm{Create}\left(120,120,3,\left(r,c\right)→\mathrm{evalf}\left(0.5\left(1+\mathrm{sin}\left(0.01\left({r}^{2}+{c}^{2}\right)\right)\right)\right)\right):$
 > $\mathrm{Embed}\left(\mathrm{img}\right)$

 > $\mathrm{img1}≔\mathrm{PadImage}\left(\mathrm{img},1..130,1..150\right):$
 > $\mathrm{img2}≔\mathrm{PadImage}\left(\mathrm{img},\mathrm{border}=10,\mathrm{top}=20,\mathrm{fill}=\left[0.5,1,0\right]\right):$
 > $\mathrm{img3}≔\mathrm{PadImage}\left(\mathrm{img},\mathrm{left}=10,\mathrm{right}=10,\mathrm{fill}=\mathrm{reflect}\right):$
 > $\mathrm{img4}≔\mathrm{PadImage}\left(\mathrm{img},\mathrm{left}=10,\mathrm{right}=10,\mathrm{fill}=\mathrm{replicate}\right):$
 > $\mathrm{Embed}\left(\left[\mathrm{img1},\mathrm{img2},\mathrm{img3},\mathrm{img4}\right]\right)$

 See Also