{"id":13520235,"url":"https://github.com/tusharnankani/CertificateGenerator","last_synced_at":"2025-03-31T16:31:00.280Z","repository":{"id":38090271,"uuid":"410064099","full_name":"tusharnankani/CertificateGenerator","owner":"tusharnankani","description":"A blazing fast mass certificate generator script for the community ⚡ ","archived":false,"fork":false,"pushed_at":"2023-03-07T06:51:33.000Z","size":940,"stargazers_count":55,"open_issues_count":3,"forks_count":17,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-10T19:12:51.144Z","etag":null,"topics":["certificate","certificate-generator","pillow","python","script"],"latest_commit_sha":null,"homepage":"https://tusharnankani.github.io/CertificateGenerator","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tusharnankani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-24T18:27:19.000Z","updated_at":"2024-05-22T11:38:16.000Z","dependencies_parsed_at":"2022-08-31T00:31:45.745Z","dependency_job_id":null,"html_url":"https://github.com/tusharnankani/CertificateGenerator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tusharnankani%2FCertificateGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tusharnankani%2FCertificateGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tusharnankani%2FCertificateGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tusharnankani%2FCertificateGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tusharnankani","download_url":"https://codeload.github.com/tusharnankani/CertificateGenerator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213468388,"owners_count":15591699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["certificate","certificate-generator","pillow","python","script"],"created_at":"2024-08-01T05:02:14.955Z","updated_at":"2024-08-01T05:12:58.911Z","avatar_url":"https://github.com/tusharnankani.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003c!-- \u003cp align=\"center\"\u003e\n  \u003cb\u003eCertificate Generator\u003c/b\u003e\n\u003c/p\u003e --\u003e\n\u003cbr\u003e\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg width =\"70%\" src=\"https://user-images.githubusercontent.com/61280281/134729891-673ca940-13dd-4c51-8597-ee576267d374.png\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e A simple mass certificate generator script for the community ⚡ \u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cbr\u003e\n  \u003ca href=\"main.py\"\u003eSource Code\u003c/a\u003e \u0026nbsp; · \u0026nbsp; \n  \u003ca href=\"#docs\"\u003eDocs\u003c/a\u003e \u0026nbsp; · \u0026nbsp;\n  \u003ca href=\"https://raw.githubusercontent.com/tusharnankani/CertificateGenerator/main/main.py\"\u003eRaw Script\u003c/a\u003e\n  \u003cbr\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n\n### Docs\n\nAll you need\n\n- Certificate\n  - Design a [simple template](template.png) on [Canva](https://www.canva.com/)\n- Font\n  - A .ttf (True-Type Font) file like [this](/font), can simply be downloaded from [here](https://www.google.com/search?q=download+.ttf+fonts).\n- Names\n  - Finally, a list of names in a .txt format or a .csv format.\n\n\u003cbr\u003e\n\n### Pillow module\n\nUsing the [pillow module](https://pypi.org/project/Pillow/) to make changes.\n\u003cbr\u003e\n\n- Calculating and declaring default values.\n\n\n```python\nfrom PIL import Image, ImageFont, ImageDraw\n\n'''Global Variables'''\nFONT_FILE = ImageFont.truetype(r'font/GreatVibes-Regular.ttf', 180)\nFONT_COLOR = \"#FFFFFF\"\n\ntemplate = Image.open(r'template.png')\nWIDTH, HEIGHT = template.size\n```\n\n\u003cbr\u003e\n\n- Placing the name on the certificate and saving to a different directory.\n\n```python\ndef make_certificates(name):\n    '''Function to save certificates as a .png file\n    Finding the width and height of the text. \n    Placing it in the center, then making some adjustments.\n    Saving the certificates in a different directory.\n    '''\n    \n    image_source = Image.open(r'template.png')\n    draw = ImageDraw.Draw(image_source)\n    name_width, name_height = draw.textsize(name, font=FONT_FILE)\n    draw.text(((WIDTH - name_width) / 2, (HEIGHT - name_height) / 2 - 30), name, fill=FONT_COLOR, font=FONT_FILE)\n    \n    image_source.save(\"./out/\" + name +\".png\")\n    print('Saving Certificate of:', name)        \n\n```\n\n\u003cbr\u003e\n\n### Names\n\n- Using `readlines()` method with a `.txt` format.\n\n```python\nnames = []\n\nwith open('names.txt') as f:\n    content = f.readlines()\n    for item in content:\n        names.append(item[:-1].title())\n```\n\u003cbr\u003e\n\n- Using [pandas to read a `.csv` file](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html).\n\n```python\nimport pandas\nnames = pandas.read_csv('names.csv', sep='#')\n```\n\n\u003cbr\u003e\n\n### Script in action\n\n\u003cbr\u003e\n\nTemplate | Result\n--- | ---\n\u003cimg src=\"template.png\"\u003e | \u003cimg src=\"out/Tushar Nankani.png\"\u003e\n\nDesign Courtesy [@GauravRaj](https://www.instagram.com/gauravraj0510)\n\n\u003cbr\u003e\n\n### Future Scope?\n\n- More customisations\n- Directly e-mail as certificates are generated\n- A web interface?\n\n\u003cbr\u003e\u003cbr\u003e\n\n#### Author\n\n[Tushar Nankani](https://tusharnankani.github.io/about/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftusharnankani%2FCertificateGenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftusharnankani%2FCertificateGenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftusharnankani%2FCertificateGenerator/lists"}