A Python package to generate certificates with a given name and a logo in the top middle.
- Generate certificates with a specified template.
- Add a custom logo to the top middle of the certificate.
- Customize the font and color of the text.
- Save generated certificates as PNG files.
You can install the package from PyPI using pip:
pip install certificate_generator
To generate certificates, you need a template image, a font file, and a logo image. Here's an example of how to use the package:
from certificate_generator import CertificateGenerator
template_path = 'path/to/template.png'
font_path = 'path/to/font/GreatVibes-Regular.ttf'
logo_path = 'path/to/logo.png'
generator = CertificateGenerator(template_path, font_path, logo_path)
# Example names
names = ["Alice", "Bob", "Charlie"]
for name in names:
generator.create_certificate(name)
You can also generate certificates using the command line. Make sure you have a names.txt
file with each name on a new line:
generate-certificates
You can customize the font size and color when creating the CertificateGenerator
instance:
generator = CertificateGenerator(template_path, font_path, logo_path, font_size=150, font_color="#000000")
By default, the certificates are saved in an out
directory. You can specify a different output directory:
generator.create_certificate(name, output_dir="./custom_output/")
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.
Tushar Nankani - Main author of the basic script
- Pillow - The friendly PIL fork.