1. An image processing device which transforms an image with a bit depth of N into an upper layer with a bit depth of M and a remaining lower layer, comprising: a histogram generation unit that generates histogram indicating occurrence frequency of each pixel value of an image with a bit depth of N; a table generation unit that generates a table listing pixel values of which occurrence frequency in the histogram generated by the histogram generation unit is equal to or more than one; a reordering unit that reorders an arrangement of values in the histogram using the table generated by the table generation unit; an update unit that updates the table generated by the table generation unit and the histogram reordered by the reordering unit; and an index image generation unit that generates an index image with a bit depth of N using the table and the histogram updated by the update unit.