A Fresnel zoneplate is a diffractive optical element consisting of concentric rings (zones) for which the transmitted light produces a focal spot that is used in all wavelength regimes, including X-rays. The pattern of transmission openings determines the location of the spot and the sub-half wavelength size of the openings can adjust the intensity. Today, very general transmission zoneplate patterns are used for many special imaging and image compensation purposes. Manufacturing zoneplates require a zoneplate pattern file, which precisely describes the size, shape, and contour of the rings based on the desired optical properties of the lens. Generating such a pattern requires the delicate balance of achieving the required optical performance while maintaining manageable file sizes and computation times. Here we describe a new algorithm meeting these needs. By precisely controlling the number of shapes in each zone, the algorithm simultaneously optimizes the desired optical tolerances with the pattern file size.