Cold-atom optical filtering enhanced by optical pumping