This is some memblock code I haven't fully tested yet but I'm going to use it for spritesheet creation in my Character Workshop.
All it does it join 2 images together either horizontally or vertically into one image. I haven't tested it much but it seems to work and I'll share any future fixes too
EDIT: code updated
function joinImages(img1,img2,Hor)
rem turn first image into memblock
mem1 = createMemblockFromImage(img1)
w1 = GetMemblockByte(mem1,0)+GetMemblockByte(mem1,1)*256
h1 = GetMemblockByte(mem1,4)+GetMemblockByte(mem1,5)*256
d1 = GetMemblockByte(mem1,8)
s1 = GetMemblockSize(mem1)
rem turn second image into memblock
mem2 = createMemblockFromImage(img2)
w2 = GetMemblockByte(mem2,0)+GetMemblockByte(mem2,1)*256
h2 = GetMemblockByte(mem2,4)+GetMemblockByte(mem2,5)*256
d2 = GetMemblockByte(mem2,8)
s2 = GetMemblockSize(mem2)
rem create a third memblock to store the final image
if Hor>0
mem3 = createMemblock(s1+s2-12)
w3 = w1+w2
h3 = h1
else
mem3 = createMemblock(s1+s2-12)
w3 = w1
h3 = h1+h2
endif
rem loop through and join the pixel data together
rem save width and height
setMemblockByte(mem3,0,mod(w3,256))
setMemblockByte(mem3,1,w3/256)
setMemblockByte(mem3,4,mod(h3,256))
setMemblockByte(mem3,5,h3/256)
for i=8 to 11
rem save bit depth as image 1 bit depth
setMemblockByte(mem3,i,GetMemblockbyte(mem1,i))
next
`transfer image data
d1 = 11
d2 = 11
d3 = 11
if Hor>0
for y=1 to h1
for x=1 to w1
for p=0 to 3
inc d1
inc d3
SetMemblockByte(mem3,d3,GetMemblockByte(mem1,d1))
next
next
for x=1 to w2
for p=0 to 3
inc d2
inc d3
SetMemblockByte(mem3,d3,GetMemblockByte(mem2,d2))
next
next
next
else
for y=1 to h1
for x=1 to w1
for p=0 to 3
inc d1
inc d3
SetMemblockByte(mem3,d3,GetMemblockByte(mem1,d1))
next
next
next
for y=1 to h2
for x=1 to w2
for p=0 to 3
inc d2
inc d3
SetMemblockByte(mem3,d3,GetMemblockByte(mem2,d2))
next
next
next
endif
rem create combined image
img3 = CreateImageFromMemblock(mem3)
deleteMemblock(mem1)
deleteMemblock(mem2)
deleteMemblock(mem3)
endfunction img3
this.mess = abs(sin(times#))