i've done this sort of thing for blitz3d - packing images into one large image (or texture) then saving the pack with a definitions file which indicates where all the individual images are within the larger image.
the image packer was written for a single-surface sprite sytem. see link ...
the image packer was written for a single-surface sprite sytem. see link ...