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

esnvutbrno/ESNcards-generator

Repository files navigation

ESNcards generator

This tools serves help for ESN members 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.

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
  • __dummy__
  • __dummy__
  • Who exactly recommend you to apply for ESNcard, where did you find out about it?
  • Do you need it before your arrival in Brno?

Download photos

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.

Then run the following command:

./download_images.py <downloaded_form_file>.csv

In case of unknown format, photo is stored in project root. Before next steps, it's needed to reformat the file and move into pictures directory under the same name.

Generating ESNcard print files

Help:

usage: generate.py [-h] [-i IMGPATH] [-p PEOPLECSV] [-o OUTPUT] [-m {photo,text,all}] [-d {normal,reversed}] [-e {clahe,heq_yuv,heq_hsv,other}] [-c] [--interactive]

optional arguments:
  -h, --help            show this help message and exit
  -i IMGPATH, --imgpath IMGPATH
                        Folder with images to be processed. (default: pictures)
  -p PEOPLECSV, --peoplecsv PEOPLECSV
                        CSV file with students and their details. (default: students.csv)
  -o OUTPUT, --output OUTPUT
                        Output file. (default: output-<mode>.pdf)
  -m {photo,text,all}, --mode {photo,text,all}
                        Printing mode. (default: all)
  -d {normal,reversed}, --direction {normal,reversed}
                        Printing direction: normal - TOP -> BOTTOM, reversed - BOTTOM -> TOP (default: normal)
  -e {clahe,heq_yuv,heq_hsv,other}, --equalizehist {clahe,heq_yuv,heq_hsv,other}
                        Equalize histogram. Modes: clahe - Contrast Limited Adaptive Histogram Equalization, heq_yuv - Global Histogram Equalization (YUV), heq_hsv - Global Histogram Qqualization (HSV), other - Placeholder for tests. (default: None)
  -c, --crop            Crop images using face detection. (default: False)
  --interactive         Ask which image to use each time - original, or cropped. (default: False)

So the typical usage would be:

To check all photos are fine and data is loaded properly, output is output-all.pdf:

./generate.py --mode all

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

./generate.py --mode text

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

./generate.py --mode photo

Authors

Sample outputs

Output of complete cards, used for debugging and photo checking

all-1

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.

Topics

Resources

License

Stars

Watchers

Forks

Languages