1. A method comprising: receiving data corresponding to image modules; determining that the image modules will fit a layout; assigning image modules to the layout, wherein assigning comprises: assigning points to the image modules based on sizes of the image modules, where the image modules comprise first image modules and second image modules, the first image modules being larger than the second image modules, each first image module being assigned more points than a second image module; assigning, to the layout, image modules from the first image modules; determining a score based on a number of points for the layout, the number of points for the layout being based on a sum of points assigned to the first image modules assigned to the layout; and assigning either first image modules to the layout or second image modules to the layout based on whether the score exceeds a threshold; determining a number of possible permutations of the image modules given one or more constraints associated with images in the image modules; selecting a number of candidate templates to accommodate the layout, the number of candidate templates being based on the number of permutations; filling candidate templates with image modules; receiving an input selecting one of the candidate templates containing image modules; and outputting data for the selected candidate template, the data for generating a display of the selected candidate template.