A non-transitory computer-readable storage medium storing computer-executable program instructions, wherein when executed by a processing device, the computer-executable program instructions cause the processing device to perform operations comprising:
- accessing a document and an output size for generating a new design document, the document comprising an object comprising visual content and an additional object, wherein the object comprises a first object type and the additional object comprises a second object type different from the first object type;
- determining, from the document, a first parameter value for a first document layout parameter from a set of document layout parameters and a second parameter value for a second document layout parameter from the set of document layout parameters;
- calculating, for each document layout parameter, (a) a first weight for the first document layout parameter based on a contribution of the first parameter value to a sum of parameter values determined from the document and (b) a second weight for the second document layout parameter based on a contribution of the second parameter value to the sum of parameter values, wherein the sum of parameter values includes a sum of the first and second parameter values, wherein a difference between the first weight and the second weight indicates a difference in prominence between the first document layout parameter and the second document layout parameter;
- determining, based on a proportion of a layout area in the document occupied by the object being greater than a proportion of the layout area in the document occupied by the additional object, a first area ordering indicating that the first object type has a higher ranking in the document the second object type;
- calculating, for a template having a set of template layout parameters corresponding to the set of document layout parameters, a score based on the set of template layout parameters and a set of weights of the set of document layout parameters, including the first weight and the second weight, wherein calculating the score for the template comprises:
- computing the set of weights based on a set of parameter values determined from the document, and
- computing, using the set of weights determined from the document, a weighted sum of the set of template layout parameters for the template;
- choosing the template based on the score being greater than a threshold;
- identifying an additional template having the first object type and the second object type;
- determining, based on a first proportion of a layout area in the additional template occupied by the second object type being greater than a second proportion of the layout area on the template occupied by the first object type, a second area ordering indicating that the second object type has a higher ranking in the additional template than the first object type;
- dropping the additional template for use with the document based on the first and second area orderings indicating different rankings for the first and second object types;
- and
- placing the object in an object container of the chosen template, thereby creating the new design document, wherein the object container corresponds with the first object type.