1. A machine readable non-transient storage medium containing executable computer program instructions which when executed by a data processing system cause said system to perform a method of image processing, the method comprising: detecting one or more regions in a first image of a high dynamic range scene according to a threshold; providing weights distributed over pixels of the first image according to the regions, wherein weights of pixels inside the regions and weights of pixels outside the regions transition smoothly in between according to a weight function, wherein the weight function specifies more than three separate weight values which change monotonically for the smooth transition between the pixels inside the region to the pixels outside the region; and blending the first image and a second image of the scene to generate a third image according to the weights based on the one or more regions.