def __init__(self, bounds, screen_bounds, quality, shift=0): self.bounds = bounds self.screen_bounds = screen_bounds self.quality = quality self.shift = shift self.x = self.bounds[0] self.y = self.bounds[2] self.xstep, self.ystep = mandel.scale(bounds, screen_bounds) self.ready_blocks = []
pass if __name__ == '__main__': import argparse parser = argparse.ArgumentParser() parser.add_argument("--width", default=300, type=int, help="Width of the screen") parser.add_argument("--height", default=200, type=int, help="Height of the screen") parser.add_argument("-q", "--quality", default=64, type=int, help="Quality (number of iterations)") parser.add_argument("-o", "--output", default="mandelbrot.png", help="Output file") args = parser.parse_args() scales = mandel.scale((-2, 1, -1, 1), (args.width, args.height)) s = mandel.build_set((-2, 1, -1, 1), scales, args.quality) im = Image.new("RGB", (args.width, args.height)) fill_image(im, s, args.quality) with open(args.output, "w") as fo: im.save(fo)