There is too little information about your target. The naiv approach would be to equally subdivide and make an atlas of equally sized tiles making sure (by scaling), the atlas is in some sort of max dimensions.
width/height = Math.Ceil(count_images / 2) * tilesize
or something like that (may be wrong just mockup) - all squares
If you have smaller and bigger textures, you’d need some sort of weighting to decide which parts should be bigger and which should be smaller.