1) Create a power of 2 image.
2) Paste in your sprites.
You can do this with your favorite art package, or with a app designed for making sprite sheets, or programmatically. For example, you can create your Power Of 2 image using a function like this:
Usage: MyNewImage = createblankimage(1024,1024)
function createblankimage(swidth as integer, sheight as integer)
newblock = CreateMemblock((swidth*sheight*4)+12)
SetMemblockInt(newblock,0,swidth)
Setmemblockint(newblock,4,sheight)
SetMemblockInt(newblock,8,32)
newimage = CreateImageFromMemblock(newblock)
DeleteMemblock(newblock)
endfunction newimage
Then you can paste you pre-loaded images into this new image using something like:
function pastetoimage(sourceimage as integer, destimage as integer, xoffset as integer, yoffset as integer)
newimageblock = creatememblockfromimage(destimage)
smallimageblock = CreateMemblockFromImage(sourceimage)
swidth = GetMemblockInt(smallimageblock, 0)
sheight = GetMemblockInt(smallimageblock, 4)
dwidth = GetMemblockInt(newimageblock,0)
xoff=xoffset*4
yoff=yoffset*dwidth*4
for y = 0 to sheight-1
dlin=dwidth*y*4
CopyMemblock(smallimageblock,newimageblock,(y*swidth*4)+12,xoff+yoff+dlin+12,swidth*4)
next y
newimage = CreateImageFromMemblock(newimageblock)
DeleteMemblock(newimageblock)
Deletememblock(smallimageblock)
endfunction newimage
Make sure your x/y offsets place the sprite images so they fit in the middle of a power of 2 box (in your example above, you could paste your first images with a x offset of 36, and y of 26 so it appears in the middle of a 256x256 square within your new atlas.).