fiCaptcha
Module for image-captcha generation
Install
Build from source
git clone https://github.com/0x7o/fiCaptcha
cd fiCaptcha
pip install .
Python pip install
pip install ficaptcha
Usage
Image Captcha
Create a folder with images for captcha:
├── images
│ ├── toy
│ ├── toy1.png
│ ├── toy2.png
│ └── ...
│ └── fox
│ ├── fox1.png
│ ├── fox2.png
│ └── ...
Import the library and create a class
size=(256, 256)
- Captcha size in pixelsimage_dir="images"
- Image folder for captchabackground_color="white"
- Background Colornoise_bg=True
- Whether or not to add noise to the backgroundnoise_im=True
- Whether or not to add noise to the imagesrotate_im=True
- Rotate images or notcount_images=5
- Number of images on the captcha
from ficaptcha.image import Captcha
c = Captcha(size=(256, 256), image_dir="images", rotate_im=False)
Let's generate our captcha
result = c.generate()
print(result)
{'class': 'toy', 'file': 'images/toy/toy5.png', 'position': (17, 139)}