Skip to content

Script used for preparing print materials to issue ESNcards -- including image downloader from Google Form, face detector to check images and PDF creator to make print resources.

License

Notifications You must be signed in to change notification settings

erman-dev/ESNcards-generator

 
 

Repository files navigation

ESNcards generator

This tools serves help for ESN sections to mass produce ESNcards, it gets input data from .csv file downloaded from Application Google Form, downloads uploaded photos of applications, and generates .pdf as print resources.

How to produce cards

Installation

Install all requirements into your python3 environment -- all listed in requirements.txt.

apt install python3 python3-venv pyton3-pip
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Download data from gForm

Download form responses in .csv format, expected headers:

  • Timestampin ISO format
  • Email
  • Name and Surname (e.g. Walter White)
  • Country (e.g. Mexico)
  • Date of Birth (e.g. 07/09/98)
  • Upload a passport-sized photo of yourself (2.7x3.7 cm) as google drive link

NOTE: The script expects data in certain columns. See config.py if you edit the Application form and data are in different columns. This usually happens with each new board. :)

NOTE: Remove any lines from the .csv file that are note the names - eg. empty rows and the column names (Name, Email, ...)

Before downloading photos

This only needs to be done once in the beginning. File client_secret.json (placed in project root) is needed to access Google Drive, you can get one from Google APIs, especially OAuth 2.0 Client IDs (with all Google Drive perms) for your own project.

Download photos

Make sure you have set up the credentials from the previous step. Then place .csv file containg the list of new student data you want to download to the input/ folder.

Finally, run the following command:

python3 download_images.py input/<downloaded_form_file>.csv

Make sure restrict input data fomrat in the google sheet to images. This script should accept all valid image formats and converts them to jpeg in the background.

Generating ESNcard print files

So the typical usage would be:

To render just labels to print them on transparent foil, output is output-text-<datetime>.pdf:

python3 generate.py --mode text

To render just photos to print, output is output-photo-<datetime>.pdf:

python3 generate.py --mode photo

In photo mode, the script sometimes detects multiple faces. U need to looks in folder decisions/ to see which of the detections is an actual face. Then in the command line write the number of the detection.

Authors

Sample outputs

Output of photos, printed on white paper/photopaper

photo-1

Output of labels, printed on transparent foil

text-1

About

Script used for preparing print materials to issue ESNcards -- including image downloader from Google Form, face detector to check images and PDF creator to make print resources.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%