Make a screenshot of a table, and get detected table right to your org notes.
Works not perfect, but at least you get a structure to start.
stuff.mp4
Prerequisites:
- Python 3.7+
- Tesseract OCR – Installation Guide
Installation steps:
- Clone the repository
- Install deps:
make install
- In your init file, add:
(add-to-list 'load-path "/path/to/img2orgtable") (require 'img2orgtable)
The main entry point is the interactive command:
(img2orgtable-screenshot-to-org)Typical setup with a keybinding:
(require 'img2orgtable)
(global-set-key (kbd "C-c t s") #'img2orgtable-screenshot-to-org)Workflow:
- Place point where you want the Org table.
- Call
M-x img2orgtable-screenshot-to-org(or your keybinding). - Use the screenshot UI that pops up to select a region with a table.
- The screenshot is saved to a temporary PNG.
- A Python script (
img2orgtable.py) is run on that PNG. - The detected Org table is inserted at point.
On failure, a user-error is raised with the underlying command output.
All options are under the img2orgtable customization group:
M-x customize-group RET img2orgtable RETPython interpreter used by img2orgtable.
;; Use project-local venv:
(setq img2orgtable-python "/path/to/project/.venv/bin/python3")
;; Or rely on auto-detection (default):
(setq img2orgtable-python nil)If nil, auto-detection order:
.venv/bin/python3under theimg2orgtableinstall directory, if executable.python3found inPATH.pythonfound inPATH.
If none are found, a user-error is signaled: No suitable python found for img2orgtable.
Path to the Python extractor script.
;; Default (relative to img2orgtable.el location):
(setq img2orgtable-python-script "img2orgtable.py")
;; Custom absolute path:
(setq img2orgtable-python-script "/opt/img2org/bin/img2orgtable.py")- If the value is relative, it is resolved relative to the directory containing
img2orgtable.el. - If absolute, it is used as-is.
Override the screenshot command used to capture the region.
;; Example: use Flameshot region and pipe PNG to file
(setq img2orgtable--screenshot-cmd "flameshot gui -r > %s")-
Default:
nil→ use built-in per-platform logic:- Linux + Wayland:
grim -g "$(slurp)" OUTFILEviash -c. - Linux + X11:
maim -s OUTFILE. - Windows: PowerShell/.NET full-screen capture to
OUTFILE.
- Linux + Wayland:
-
When non-nil, must be a shell command string.
-
If the string contains
%s, it is replaced with the shell-quoted output filename. -
If it does not contain
%s, the shell-quoted filename is appended.
Examples:
;; Custom script that writes PNG to a given path
(setq img2orgtable--screenshot-cmd "~/bin/my-screenshot-script %s")
;; Hypothetical macOS setup using screencapture:
(setq img2orgtable--screenshot-cmd "screencapture -i %s")If the screenshot command exits non-zero, the command output is shown via:
Screenshot failed: <output>
Maximum time (in seconds) to wait for external commands.
(setq img2orgtable-timeout 20) ;; defaultCurrently exposed as a defcustom for clamping misbehaving screenshot tools or Python calls; can be wired into timeout handling where needed.
-
Command:
img2orgtable-screenshot-to-org -
Uses:
- Screenshot backend (
img2orgtable--screenshot-cmdor platform defaults) - Python interpreter (
img2orgtable-python/ auto-detection) - Extractor script (
img2orgtable-python-script)
- Screenshot backend (
-
Output: Org table inserted at point, suitable as a starting structure for manual cleanup.