Skip to content

TheRyanMajd/img-to-ics

Repository files navigation

imgToICS — Image-to-Calendar with GPT-4o

by Ryan Majd

ChatGPTPython

imgToICSBanner

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 -o or --ocr-only to enable the same mode (Does not send image to OpenAI).

GUI screenshot


Requirements

Type What you need
Python 3.8+ (tested on 3.12)
Python packages install with ./install_py_pkgs.sh or
pip install PySimpleGUI requests python-dotenv pillow pytesseract
System package tesseract-ocr binary
macOS 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)

Installation

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 pytesseract

Create a .env file in the project root and add:

OPENAI_API_KEY='sk-xxxxxxxx'

Quick Start

GUI

python imgToICS_GUI.py
  1. Select image.
  2. Paste your OpenAI key (auto-fills from .env if present).
  3. Choose output folder.
  4. (Optional) Tick OCR-only (beta) to keep the flyer image local.
  5. Click Generate ICS – your calendar file appears in the folder you picked.

CLI

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

How It Works

  1. Image mode – base-64 image → OpenAI Vision → iCalendar text.
  2. OCR-only – local Tesseract → raw text → GPT-4o (text only).
  3. Script extracts everything from BEGIN:VCALENDAR to END:VCALENDAR, names the file from the SUMMARY, 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...

Key Libraries

  • PySimpleGUI – cross-platform UI
  • Pillow (PIL) – image handling
  • pytesseract – OCR
  • requests – HTTPS calls
  • python-dotenv – keeps secrets out of source

Security & Privacy

  • 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 .ics before sharing since AI hallucinates a lot.

Roadmap

  • OCR fallback
  • Date disambiguation improvements
  • Batch-process entire folders of images
  • Unit tests & CI
  • Whatever cool idea y'all suggest

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors