Skip to content

serebryakov02/SnipText

Repository files navigation

Project Status

  • SnipText is under ongoing development; build configuration and features will evolve alongside the main README instructions as time allows.
  • macOS is fully supported today; Windows/Linux ports are planned and will be documented once available.

What SnipText Does

  • Desktop utility that lets you select an area of the screen, runs Tesseract OCR on the captured pixels, copies the recognized text to the clipboard, and (optionally) saves the screenshot.
  • Ships with a minimal Qt Widgets UI: one button to start a capture, overlay color selector, and toggle for saving screenshots.
  • Features/UI are still evolving; expect updates as development continues.

Demo Video

video

Building and Configuration

Current scope

  • Targets macOS builds only (Qt Widgets app bundled as a .app).
  • Uses AppleClang with C++17, Qt5/Qt6 Widgets, and Tesseract OCR + Leptonica.
  • Android / Windows / Linux boilerplate generated by Qt remains untouched for now; future work can expand those sections.

Qt configuration

  • CMake expects Qt to be discoverable via QT_DIR or CMAKE_PREFIX_PATH.
  • Example: cmake -S . -B build -DQT_DIR=/Users/me/Qt/6.6.3/macos/lib/cmake/Qt6.
  • All sources are bundled into qt_add_executable (Qt6) or add_executable (Qt5).

Tesseract / Leptonica integration

  • Configurable prefixes:
    • TESSERACT_ROOT — base prefix containing include/ and lib/ for Tesseract (defaults to /opt/homebrew, /usr/local, /opt/local).
    • TESSDATA_PREFIX — directory containing tessdata/ files. Defaults to ${TESSERACT_ROOT}/share/tessdata (e.g., /opt/homebrew/share/tessdata).
  • find_path and find_library locate headers (tesseract/baseapi.h) and libs (tesseract, lept/leptonica).
  • On failure, configuration stops with guidance to install Tesseract (e.g., brew install tesseract) or set TESSERACT_ROOT.
  • Runtime library paths (RPATHs) are set from the located libraries so macOS’s dynamic loader (dyld) picks them up automatically without extra environment tweaks.
  • The resolved tessdata path is baked into the binary via DEFAULT_TESSDATA_PATH so OCR init uses that location without editing the source.

Runtime behavior tie-ins

  • mainwindow.cpp reads DEFAULT_TESSDATA_PATH and passes it to OcrService::initialize().
  • If OCR init fails (for example due to a bad tessdata path), the app shows a warning dialog and continues running, but captures won't produce text until it’s fixed.

Future expansion notes

  • Windows/Linux support would extend _TESS_SEARCH_PATHS and add platform-specific logic for library names / RPATH equivalents.

Permissions

  • On macOS, grant SnipText screen-recording permission (System Settings ▸ Privacy & Security ▸ Screen & System Audio Recording) so the capture overlay works.

Usage recap

mkdir -p build
cmake -S . -B build \
      -DQT_DIR=/path/to/Qt/lib/cmake/Qt6 \
      -DTESSERACT_ROOT=/opt/homebrew \
      -DTESSDATA_PREFIX=/opt/homebrew/share/tessdata
cmake --build build

Adjust the prefixes to match your environment; once CMakeCache.txt exists you can run cmake -LH build to review/edit cached values.

About

Screen capture tool that extracts text from a selected screen area and copies it to the clipboard. Supports multi-selection, allowing extraction from multiple areas in a single action, along with customizable settings.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors