%COMP 256 Assignment 2
%Adrian Ilie

function newimg=imgpad(im, newheight, newwidth, voffset, hoffset);
%pads and image to a specified width and height, with offsets

[height,width,depth]=size(im);
newimg=zeros(newheight,newwidth,depth);
for i=1:depth
    newimg(voffset+1:voffset+height,hoffset+1:hoffset+width,i)=im(:,:,i);
end
newimg=uint8(newimg);
