1. A method for generating a portrait of a subject for an identification document, the method comprising: receiving a photo image of the subject, the photo image including the subject's face in a foreground against an arbitrary background; determining the arbitrary 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 for the identification document of the subject, the portrait being based on the photo image with the determined background masked.