Hi Lewis
If I have understood your question correctly, you want to do the following:
1. clear all;clc
A=imread('image1.jpg');
figure(1);imshow(A);
[sza1 sza2 sza3]=size(A);
2. define offsets, in this question 2 2D offset points, for instance
dx1=20
dy1=30
dx2=60
dy2=120
3. generate void image to output, 0 is white, 255 is black
B=255*ones(sza1+dy1+dy2,sza2+dx1+dx2,sza3);
B=uint8(B);
4. overlay R G B layers separately
A1=A(:,:,1);A2=A(:,:,2);A3=A(:,:,3);
B1=B([dy1:1:sza1+dy1-1],[dx1:1:sza2+dx1-1],1);
B2=B([dy1:1:sza1+dy1-1],[dx1:1:sza2+dx1-1],2);
B3=B([dy1:1:sza1+dy1-1],[dx1:1:sza2+dx1-1],3);
B1=A1;
B2=A2;
B3=A3;
B([dy1:1:sza1+dy1-1],[dx1:1:sza2+dx1-1],1)=B1;
B([dy1:1:sza1+dy1-1],[dx1:1:sza2+dx1-1],2)=B2;
B([dy1:1:sza1+dy1-1],[dx1:1:sza2+dx1-1],3)=B3;
et voilà
5.
6. post-processing, like for instance saving result to file: imwrite(B,'result_file_name.jpg')
so dear Lewis
if you find this answer useful would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John BG