Implemented selection of the optimal image-packed layout.