redo im_invertlut() as a class