Skip to main content

Transform handwritten images into structured documents (Markdown, JSON, YAML, XML)

Project description

Handmark

Handmark is a Python CLI tool that converts handwritten notes from images into Markdown files. It uses Azure AI to process images and extract text, making it easy to digitize handwritten content.

License: MIT Version


Features

  • 🖼️ Image to Markdown Conversion - Transform handwritten notes from images into clean, formatted Markdown
  • 🧠 Intelligent Title Extraction - Automatically detects and extracts titles from content for smart file naming
  • Easy CLI Interface - Simple, intuitive commands with rich console output and error handling
  • 🤖 Azure AI Integration - Leverages Azure AI models for accurate handwriting recognition
  • 🔧 Model Configuration - Choose from multiple AI models and save your preferences
  • 🔐 Secure Authentication - GitHub token-based authentication with secure local storage
  • 📁 Flexible Output - Customize output directory and filename options

Quick Start

  1. Install Handmark:

    pip install handmark
    
  2. Configure authentication:

    handmark auth
    
  3. Process your first image:

    handmark digest path/to/your/image.jpg
    

That's it! Your handwritten notes will be converted to a Markdown file.


Installation

Requirements

  • Python 3.10 or higher
  • A GitHub token (for Azure AI access)

Install from PyPI

pip install handmark

Install with uv (recommended)

uv pip install handmark

Install from source

git clone https://github.com/devgabrielsborges/handmark.git
cd handmark
pip install -e .

Usage

Getting Started

Before processing images, you need to configure authentication:

handmark auth

This will prompt you to enter your GitHub token, which provides access to Azure AI services.

Commands Overview

Command Description
handmark digest <image> Convert handwritten image to Markdown
handmark auth Configure GitHub token authentication
handmark conf Select and configure AI model
handmark --version Show version information

Process an Image

handmark digest <image_path> [options]

Options:

  • -o, --output <directory> - Specify output directory (default: current directory)
  • --filename <name> - Custom output filename (default: response.md)

Examples:

# Basic usage - process image and save to current directory
handmark digest samples/prova.jpeg

# Custom output directory
handmark digest samples/prova.jpeg -o ./notes

# Custom filename
handmark digest samples/prova.jpeg --filename lecture-notes.md

# Both custom directory and filename
handmark digest samples/prova.jpeg -o ./outputs --filename my-notes.md

Supported Image Formats

Handmark supports common image formats including:

  • JPEG/JPG
  • PNG
  • And other formats supported by Azure AI Vision

Configure Authentication

handmark auth

This will prompt you to enter your GitHub token, which is required for Azure AI integration. The token is securely stored in a .env file in the project directory.

Configure Model

handmark conf

This command lets you select and configure the AI model used for image processing. You can choose from available Azure AI models, and your selection will be saved for future runs. If no model is configured, the system will use a default model.

Check Version

handmark --version

Example

Here's a real-world example of Handmark in action:

Input image (samples/prova.jpeg):

Handwritten notes example

Output (prova-response.md):

# Primeiro Exercício Escolar - 2025.1
Leia atentamente todas as questões antes de começar a prova. As respostas obtidas somente terão validade se respondidas nas folhas entregues. Os cálculos podem ser escritos à lápis e em qualquer ordem. Evite usar material diferente do que foi apresentado em sala ou justifique o material extra adequadamente para validá-lo. Não é permitido uso de celular ou calculadora.

1. (2 pontos) Determine a equação do plano tangente a função $f(x,y) = \sqrt{20 - x^2 - 7y^2}$ em (2,1). Em seguida, calcule um valor aproximado para $f(1,9 , 1,1)$.
2. (2 pontos) Determine a derivada direcional de $f(x,y) = (xy)^{1/2}$ em $P(2,8)$, na direção de $Q(5,4)$.
3. (2 pontos) Determine e classifique os extremos de $f(x,y) = x^4 + y^4 - 4xy + 2$
4. (2 pontos) Usando integrais duplas, calcule o volume acima do cone $z = (x^2 + y^2)^{1/2}$ e abaixo da esfera $x^2 + y^2 + z^2 = 1$
5. (2 pontos). Sabendo que $E$ é o volume delimitado pelo cilindro parabólico $z = 1 - y^2$, e pelos planos $z = 0$, $x = 1$, $x = -1$, apresente um esboço deste volume e calcule a integral tripla.
$$
\iiint_E x^2e^y dV
$$

The output is saved as a Markdown file with a filename derived from the detected title.

See the full example output


Troubleshooting

Common Issues

Authentication Error:

Error: GitHub token not configured or invalid

Solution: Run handmark auth to configure your GitHub token.

Image Format Error:

Error: Unsupported image format

Solution: Ensure your image is in a supported format (JPEG, PNG, etc.).

No Model Configured Warning:

No model configured. Using default model

Solution: Run handmark conf to select your preferred AI model.

Getting Help

  • Check the issues page for known problems
  • Create a new issue if you encounter a bug
  • Use handmark --help for command-line help

Development

Prerequisites

  • Python 3.10 or higher
  • A GitHub token for Azure AI integration
  • uv (recommended) or pip for package management

Setup

  1. Clone the repository:

    git clone https://github.com/devgabrielsborges/handmark.git
    cd handmark
    
  2. Install dependencies:

    # Using uv (recommended)
    uv pip install -e .
    
    # Or using pip
    pip install -e .
    
  3. Configure for development:

    handmark auth  # Configure your GitHub token
    handmark conf  # Select preferred AI model
    

Project Structure

  • src/ - Source code
    • main.py - CLI interface and command handlers
    • dissector.py - Image processing and Azure AI API interaction
    • model.py - AI model management and configuration
    • utils.py - Helper functions and utilities
  • samples/ - Sample images for testing and demonstration
  • tests/ - Comprehensive unit tests
  • .github/ - GitHub workflows and project instructions


Contributing

Contributions are welcome! Please feel free to:

  • Open an issue for bug reports or feature requests
  • Submit a pull request with improvements
  • Help improve documentation
  • Share examples of your handwritten notes processed with Handmark

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests if applicable
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author


Last updated: May 29, 2025

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

handmark-0.4.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

handmark-0.4.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file handmark-0.4.0.tar.gz.

File metadata

  • Download URL: handmark-0.4.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for handmark-0.4.0.tar.gz
Algorithm Hash digest
SHA256 be404270ee3a7d4686affddc908af8ba880a49aef4f0bc0a6aa435468abedc4a
MD5 6a3ed644264b175a154e3b5ba4f5bda2
BLAKE2b-256 15d84d904c779956ad98dc2d4786f3b172682aa10dd8330c5648da6ca326e75b

See more details on using hashes here.

File details

Details for the file handmark-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: handmark-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for handmark-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85159fe64422bd91986300e6bdb97eb6d55b60585b5c165b3b78b606b0abb92c
MD5 22ad75a096e48977322829d7f5c65e1a
BLAKE2b-256 b330b8a8ac045f607e2b2ca93d0da4dfffacab2b276c3c4fc69f3645d841823b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page