Let's start with a simple scenario and add a 25-pixel border around the image. This is done by combining the padarray and Fill functions, as follows:
using Images, ImageView
pad_vertical = 25
pad_horizontal = 25
pad_color = RGB4{N0f8}(0.5,0.5,0.) # border color
img = load("sample-images/cats-3061372_640.jpg");
img = padarray(img, Fill(pad_color, (pad_vertical, pad_horizontal)))
img = parent(img) # reset indices to start from 1
imshow(img)
The resulting output is as follows:
padarray is using a custom index offset, which results in the first pixel starting from a number other than 1. parent is being used to reset the indices and starts them from 1.