1. An image encoding apparatus that performs hierarchical coding of images composing a moving image with a plurality of layers, the image encoding apparatus comprising: a first generating unit that generates a first image and a second image of different layers from the images; an encoding unit that encodes at least either of the first image and the second image; a first acquiring unit that acquires information indicating whether a first area capable of being encoded without reference to another area in the first image exists in the first image; and a setting unit that sets a second area at a position corresponding to the first area in the first image in the second image if the first area exists in the first image on the basis of the information acquired by the first acquiring unit.