According to at least one embodiment, a method, computer system, and computer program product for contextually masking visual elements in a photograph is provided. The present invention may include receiving privacy preferences from one or more users, identifying individuals in a photograph, constructing a ruleset based on the privacy preferences of the identified individuals within the photograph and, based on the ruleset, masking one or more visual elements within the photograph from view of a viewer.