We demonstrate a digital micromirror device (DMD)-based optical system that converts a spatially noisy quasi-Gaussian to an eighth-order super-Lorentzian flat-top beam. We use an error-diffusion algorithm to design the binary pattern for the Texas Instruments DLP device. Following the DMD, a telescope with a pinhole low-pass filters the beam and scales it to the desired sized image. Experimental measurements show a 1% root-mean-square (RMS) flatness over a diameter of 0.28 mm in the center of the flat-top beam and better than 1.5% RMS flatness over its entire 1.43 mm diameter. The power conversion efficiency is 37%. We develop an alignment technique to ensure that the DMD pattern is correctly positioned on the incident beam. An interferometric measurement of the DMD surface flatness shows that phase uniformity is maintained in the output beam. Our approach is highly flexible and is able to produce not only flat-top beams with different parameters, but also any slowly varying target beam shape. It can be used to generate the homogeneous optical lattice required for Bose-Einstein condensate cold atom experiments. (C) 2009 Optical Society of America