Shouldn't this use `img_as_float` to take care of different dtype images?