def captcha(self, path=None, fmt='JPEG'):
    "Create a captcha.\n\n        Args:\n            path: save path, default None.\n            fmt: image format, PNG / JPEG.\n        Returns:\n            A tuple, (name, text, StringIO.value).\n            For example:\n                ('EXAMPLE_KEY', 'JGW9', '\x89PNG\r\n\x1a\n\x00\x00\x00\r...')\n\n        "
    image = Image.new('RGB', (self.width, self.height), (255, 255, 255))
    image = self.background(image)
    image = self.text(image, self.fonts, drawings=['warp', 'rotate', 'offset'])
    image = self.curve(image)
    image = self.noise(image)
    image = self.smooth(image)
    name = ''.join(random.sample(((string.ascii_lowercase + string.ascii_uppercase) + '3456789'), 24))
    text = ''.join(self._text)
    out = BytesIO()
    image.save(out, format=fmt)
    if path:
        image.save(os.path.join(path, name), fmt)
    return (name, text, out.getvalue())
Create a captcha.

        Args:
            path: save path, default None.
            fmt: image format, PNG / JPEG.
        Returns:
            A tuple, (name, text, StringIO.value).
            For example:
                ('EXAMPLE_KEY', 'JGW9', 'PNG


...')
def captcha(self, path=None, fmt='JPEG'):
    "Create a captcha.\n\n        Args:\n            path: save path, default None.\n            fmt: image format, PNG / JPEG.\n        Returns:\n            A tuple, (name, text, StringIO.value).\n            For example:\n                ('EXAMPLE_KEY', 'JGW9', '\x89PNG\r\n\x1a\n\x00\x00\x00\r...')\n\n        "
    image = Image.new('RGB', (self.width, self.height), (255, 255, 255))
    image = self.background(image)
    image = self.text(image, self.fonts, drawings=['warp', 'rotate', 'offset'])
    image = self.curve(image)
    image = self.noise(image)
    image = self.smooth(image)
    name = .join(random.sample(((string.ascii_lowercase + string.ascii_uppercase) + '3456789'), 24))
    text = .join(self._text)
    out = BytesIO()
    image.save(out, format=fmt)
    if path:
        image.save(os.path.join(path, name), fmt)
    return (name, text, out.getvalue())