1. A method for generating a portrait of a subject for an identification document, the method comprising: receiving, at a mobile device, a photo image of the subject, the photo image including a foreground and a background, wherein the foreground includes the subject's face and the background does not include the subject's face; determining the background of the photo image based on the photo image alone and without user intervention; masking the determined background from the photo image; and subsequently generating the portrait of the subject based on the photo image with the background masked.