A method to decode image data at an image decoder, the method comprising: receiving image coded data, the image coded data comprising a compressed low dynamic range image, a compressed residual image, and a prediction function, wherein for input pixel values in a low dynamic range the prediction function provides corresponding predicted pixel values in a high dynamic range; decompressing the compressed low dynamic range image to generate a reconstructed low dynamic range image; decompressing the compressed residual image to generate a decoded residual image, wherein the decoded residual image is based on a reference high dynamic range image representing the same scene as the reconstructed low dynamic range image and the low dynamic range image is generated by an encoder by applying a tone-mapping function to the reference high dynamic range image; applying the prediction function to the reconstructed low dynamic range image to generate a predicted high dynamic range image; and combining the predicted high dynamic range image with the decoded residual image data to generate an output high dynamic range image, wherein the method is performed by one or more processors, wherein the prediction function is based on the reconstructed low dynamic range image and the reference high 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, wherein for each pixel value represented in the lower dynamic range image, the corresponding pixel values in the high dynamic range image are the pixel values of those pixels in the high dynamic range image that correspond to pixels in a respective set of pixels in the lower dynamic range image that all have the respective pixel value in the lower dynamic range image. receiving image coded data, the image coded data comprising a compressed low dynamic range image, a compressed residual image, and a prediction function, wherein for input pixel values in a low dynamic range the prediction function provides corresponding predicted pixel values in a high dynamic range; decompressing the compressed low dynamic range image to generate a reconstructed low dynamic range image; decompressing the compressed residual image to generate a decoded residual image, wherein the decoded residual image is based on a reference high dynamic range image representing the same scene as the reconstructed low dynamic range image and the low dynamic range image is generated by an encoder by applying a tone-mapping function to the reference high dynamic range image; applying the prediction function to the reconstructed low dynamic range image to generate a predicted high dynamic range image; and combining the predicted high dynamic range image with the decoded residual image data to generate an output high dynamic range image, wherein the method is performed by one or more processors, wherein the prediction function is based on the reconstructed low dynamic range image and the reference high 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, wherein for each pixel value represented in the lower dynamic range image, the corresponding pixel values in the high dynamic range image are the pixel values of those pixels in the high dynamic range image that correspond to pixels in a respective set of pixels in the lower dynamic range image that all have the respective pixel value in the lower dynamic range image.