1. A method of classifying at least one image in an electronic device having an electronic processor, a display, and a memory storing one or more contents comprising the at least one image, one or more contents, the method comprising: storing, in the memory, information related to a plurality of categories forming a hierarchical structure; mapping via the electronic processor, each of the at least one image from the memory to one among the plurality of categories based on at least one piece of information on the at least one image and information on the plurality of categories; when content-related information of a specific category of a plurality of categories determined according to the mapping meets a preset condition related to a number of images mapped to the specific category, modifying, via the electronic processor, the hierarchical structure associated with the specific category, wherein modifying the hierarchical structure of the categories comprises: merging the specific category into a higher category in the hierarchical structure when a number of contents of the specific category is less than a first preset number, and classifying the specific category into one or more lower categories in the hierarchical structure when the number of contents of the specific category is greater than a second preset number; and in response to a request for displaying the at least one image, displaying, via the display, the at least one image based on the modified updated hierarchical structure, wherein the updated hierarchical structure reduces deviation of a number of images mapped to one or more categories of the plurality of categories after reclassifying the categories in the updated hierarchical structure.