1. A computer-implemented method for building an exemplar dictionary comprising exemplars for encoding images, the method comprising: identifying a set of exemplars, each exemplar comprising at least one image; performing hierarchical clustering of the set of exemplars to generate a plurality of clusters arranged as a hierarchy, the hierarchy comprising a high level and a low level, such that clusters at the high level are closer to a root of the hierarchy compared to clusters at the low level, the hierarchical clustering comprising: generating clusters at each level of the hierarchy, the generating comprising a filtering of exemplars such that the filtering performed at the high level generates less information per exemplar compared to the filtering performed at the low level; and storing an exemplar dictionary comprising information describing the hierarchy of clusters, wherein the exemplar dictionary is used to identify predictor blocks for encoding an image.