The present repo contains a Python script to process signature images, it returns a png
image with transparent background containing only the signature.
The Python PIL (Python Image Library) package with Python 3 is used in this repo.
To install PIL via pip:
pip install pillow
The main script is signature.py
, which contains a set of utility functions developed so far.
- Binarize your signature
- Remove background and make it transparent
- Smooth image
- Image orientation
- Crop to get only signature
The main script, signature.py
requires a set of parameters that are needed in the parser.
$ python signature.py -h
usage: signature.py [-h] -i INPUT [-o OUTPUT] [-th THRESHOLD]
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
Input image.
-o OUTPUT, --output OUTPUT
Output image.
-th THRESHOLD, --threshold THRESHOLD
An example to use this script is as follows:
$ python signature.py -i imgs/example.jpg -o imgs/result.png -th 190