redo im_rank_image() as a class