fix im_invertlut()

didn't work for 1 high input matrices
didn't work for file output