A two layer coding algorithm for high dynamic range images is discussed. In the first layer, a low dynamic range image is encoded by a conventional codec, and then the residual information that represents the difference between an original and the decoded images in the first layer is encoded in the second layer, which realizes compatibility with conventional image file formats. Our method utilizes the approximation of an inverse tone mapping function that reduces the high dynamic range to a displayable range. Our algorithm significantly improves a compression performance, compared to conventional methods.