1. A method comprising: (i) receiving a plurality of input images from which it is required to automatically form a collage; (ii) specifying formation of the collage from the input images as a labeling problem; (iii) forming an energy function for the labeling problem, that energy function comprising a plurality of terms each relating to one or more criteria to be used in forming the collage; (iv) specifying one or more constraints to be applied to the energy function; (v) using a multi-stage optimization process to optimize the energy function taking into account the specified constraints such that at least one possible labeling is found for the collage; (vi) using the labeling found for the collage to form the collage using an image blending process and outputting the collage.