% Draw a frame on the edge of a grayscale image
%   using vectorized code

close all

% Read the original picture (PNG file) and show it:
P= imread('liftingbody.png');
imshow(P);
pause

% Add a frame 50 pixels wide on the edge of picture
width= 50;
frameColor= 20;  % dark gray
[nr,nc]= size(P);

P(1:width, 1:nc)      = frameColor;              %top
P(nr-width+1:nr, 1:nc)= frameColor;              %bottom
P(width+1:nr-width, 1:width)= frameColor;        %left
P(width+1:nr-width, nc-width+1:nc)= frameColor;  %right

imshow(P)
