1. An image encoding apparatus, comprising: a processor including: a detection unit detecting edge blocks as blocks each including an edge in an image composed of plural blocks; and a giving unit giving a priority of image quality improving processing which is executed with respect to the edge blocks in encoding processing of the image to each of the edge blocks detected, the priority corresponding to the number of blocks which have not been detected as the edge blocks by the detection unit and which are on a periphery of the each of the edge blocks detected.