A method for encoding a high dynamic range image, comprising the steps of - obtaining a lower dynamic range image corresponding to the high dynamic range image, the lower dynamic range image being obtainable from the high dynamic range image by a dynamic range reduction process and containing the same scene as the high dynamic range image; - generating a prediction function for predicting a high dynamic range image from the lower dynamic range image, wherein generating the prediction function involves: for each pixel value represented in the lower dynamic range image, identifying the set of those pixels in the lower dynamic range image that have said pixel value; and for each of these sets, identifying pixels in the high dynamic range image that correspond to the pixels in the respective set, thereby identifying pixel values in the high dynamic range image that correspond to each pixel value represented in the lower dynamic range image, and wherein the prediction function is based at least in part on pixel values of the pixels in the high dynamic range image for which corresponding pixels in the lower dynamic range image all have the same pixel value, and exploits statistical relationships between pixel values of the pixels in the lower dynamic range image and corresponding pixel values in the high dynamic range image, thereby determining, for each set, a predicted pixel value in the high dynamic range image; - applying the prediction function to the lower dynamic range image to obtain a predicted high dynamic range image; - obtaining a residual image from the predicted high dynamic range image and the high dynamic range image; and - encoding and storing data representing the lower dynamic range image, the prediction function and the residual image in a video stream, wherein the high dynamic range image and the lower dynamic range image each comprise a frame in a video sequence, and the prediction function is updated for each frame in the video sequence. - obtaining a lower dynamic range image corresponding to the high dynamic range image, the lower dynamic range image being obtainable from the high dynamic range image by a dynamic range reduction process and containing the same scene as the high dynamic range image; - generating a prediction function for predicting a high dynamic range image from the lower dynamic range image, wherein generating the prediction function involves: for each pixel value represented in the lower dynamic range image, identifying the set of those pixels in the lower dynamic range image that have said pixel value; and for each of these sets, identifying pixels in the high dynamic range image that correspond to the pixels in the respective set, thereby identifying pixel values in the high dynamic range image that correspond to each pixel value represented in the lower dynamic range image, and wherein the prediction function is based at least in part on pixel values of the pixels in the high dynamic range image for which corresponding pixels in the lower dynamic range image all have the same pixel value, and exploits statistical relationships between pixel values of the pixels in the lower dynamic range image and corresponding pixel values in the high dynamic range image, thereby determining, for each set, a predicted pixel value in the high dynamic range image; for each pixel value represented in the lower dynamic range image, identifying the set of those pixels in the lower dynamic range image that have said pixel value; and for each of these sets, identifying pixels in the high dynamic range image that correspond to the pixels in the respective set, thereby identifying pixel values in the high dynamic range image that correspond to each pixel value represented in the lower dynamic range image, and wherein the prediction function is based at least in part on pixel values of the pixels in the high dynamic range image for which corresponding pixels in the lower dynamic range image all have the same pixel value, and exploits statistical relationships between pixel values of the pixels in the lower dynamic range image and corresponding pixel values in the high dynamic range image, thereby determining, for each set, a predicted pixel value in the high dynamic range image; - applying the prediction function to the lower dynamic range image to obtain a predicted high dynamic range image; - obtaining a residual image from the predicted high dynamic range image and the high dynamic range image; and - encoding and storing data representing the lower dynamic range image, the prediction function and the residual image in a video stream, wherein the high dynamic range image and the lower dynamic range image each comprise a frame in a video sequence, and the prediction function is updated for each frame in the video sequence.