Learn R Programming

imager (version 0.45.8)

pad: Pad image with n pixels along specified axis

Description

Pad image with n pixels along specified axis

Usage

pad(im, nPix, axes, pos = 0, val)

Value

a padded image

Arguments

im

the input image

nPix

how many pixels to pad with

axes

which axes to pad along

pos

-1: prepend 0: center 1: append

val

colour of the padded pixels (default 0 in all channels). Can be a string for colour images, e.g. "red", or "black".

Author

Simon Barthelme

Examples

Run this code
cimg.limit.openmp()
pad(boats,20,"xy") %>% plot
pad(boats,20,pos=-1,"xy") %>% plot
pad(boats,20,pos=1,"xy") %>% plot
pad(boats,20,pos=1,"xy",val="red") %>% plot

Run the code above in your browser using DataLab