Calculate resize ratio