by Ryan Majd
Convert any event flyer (JPEG/PNG) straight into a ready-to-import .ics calendar file.
Two Ways to Tango:
- GUI (
imgToICS_GUI.py) – drag-and-drop window with an “OCR-only (beta)” checkbox. - CLI (
imgToICS_CLI.py) – terminal tool; add-oor--ocr-onlyto enable the same mode (Does not send image to OpenAI).
| Type | What you need |
|---|---|
| Python | 3.8+ (tested on 3.12) |
| Python packages | install with ./install_py_pkgs.sh orpip install PySimpleGUI requests python-dotenv pillow pytesseract |
| System package | tesseract-ocr binarymacOS brew install tesseract · Ubuntu (usually preinstalled) sudo apt install tesseract-ocr · Windows installer.. Google it |
| OpenAI API key | Key with GPT-4o multimodal access (funded ≥ $5) |
git clone https://github.com/TheRyanMajd/img-to-ics
cd img-to-ics
# choose ONE of the following
./install_py_pkgs.sh
# or
pip install PySimpleGUI requests python-dotenv pillow pytesseractCreate a .env file in the project root and add:
OPENAI_API_KEY='sk-xxxxxxxx'python imgToICS_GUI.py- Select image.
- Paste your OpenAI key (auto-fills from
.envif present). - Choose output folder.
- (Optional) Tick OCR-only (beta) to keep the flyer image local.
- Click Generate ICS – your calendar file appears in the folder you picked.
python imgToICS_CLI.py <image_path> <output_dir> [-o | --ocr-only]Examples
# Standard multimodal
python imgToICS_CLI.py flyers/hackathon.png ~/CalendarEvents/
# Offline OCR only
python imgToICS_CLI.py flyers/hackathon.png ~/CalendarEvents/ --ocr-only- Image mode – base-64 image → OpenAI Vision → iCalendar text.
- OCR-only – local Tesseract → raw text → GPT-4o (text only).
- Script extracts everything from
BEGIN:VCALENDARtoEND:VCALENDAR, names the file from theSUMMARY, and writes it.
Default assumptions:
- All dates are treated as future dates... cause why the hell would you want to book events back in time
- If no end time is provided, the event is set to 3 hours.
- Maybe I'll add a defaults.json file so that y'all can change these easier...
- PySimpleGUI – cross-platform UI
- Pillow (
PIL) – image handling - pytesseract – OCR
- requests – HTTPS calls
- python-dotenv – keeps secrets out of source
- API keys stay in memory only – never written to disk or sent anywhere else.
- In OCR-only mode the image never leaves your computer.
- Always glance over the generated
.icsbefore sharing since AI hallucinates a lot.
- OCR fallback
- Date disambiguation improvements
- Batch-process entire folders of images
- Unit tests & CI
- Whatever cool idea y'all suggest
MIT — see LICENSE.