def save(self, filename, iterations):

        with open(filename, "wb") as f:
            f.write(struct.pack("8B", 137, 80, 78, 71, 13, 10, 26, 10))
            output_chunk(f, "IHDR", struct.pack("!2I5B", self.width, self.height, 8, 2, 0, 0, 0))
            compressor = zlib.compressobj()
            data = array("B")
            pixels = self.display_pixels(iterations)
            for y in range(self.height):
                data.append(0)
                for x in range(self.width):
                    for channel in range(3):
                        data.append(min(255, max(0, int(pixels.next() * 255.0 + 0.5))))
            compressed = compressor.compress(data.tostring())
            flushed = compressor.flush()
            output_chunk(f, "IDAT", compressed + flushed)
            output_chunk(f, "IEND", "")
save the image to given filename assuming the given number
dataset/ETHPy150Open jtauber/pyifs/image.py/Image.save