Create Custom OMR Apps via Opne Source Python APIs
A Leading Opne Source Free Python-based OMR Library Designed for Optical Mark Recognition (OMR) Tasks. It Supports Template-based OMR Detection, Image Preprocessing and Customization.
What is Mork Librar?
Mork is a modern, open-source Python library designed for Optical Mark Recognition (OMR) tasks. Mork provides a robust and flexible foundation that allows software developers to easily build a form scanner for student tests, processing surveys, or managing data collection via checkboxes and bubbles. Developed with simplicity and performance in mind, it enables developers to extract marked data from scanned sheets with high precision. Hosted on GitHub, the library supports template-based recognition workflows that allow easy definition of answer boxes and regions on printed forms. Its modular architecture, image processing capabilities, and customizable recognition zones make it a powerful tool for both educational and business-oriented OMR solutions.
Mork is designed to be straightforward yet powerful. It supports high-quality OMR detection by analyzing scanned sheets and detecting filled bubbles, checkboxes, and other marked regions. Developers can use it to create complete end-to-end OMR workflows—designing templates, calibrating scan alignment, identifying answer zones, and extracting user responses with precision. Mork is licensed under the MIT License, making it free for commercial and personal use. It’s actively developed and maintained by the open-source community. Its support for flexible templates, accurate detection, and easy integration with other systems makes it an excellent tool for developers in education, research, and data collection industries. With just a few lines of code, you can automate the analysis of forms, tests, and surveys—saving countless hours of manual work.
Getting Started with Mork
The recommend way to install Mork Library is using Brew. Please use the following command for a smooth installation
Install Mork Library via Brew
brew install imagemagick
Install Mork via GitHub
git clone https://github.com/giuseb/mork.git
You can download the library directly from GitHub
Template-Based OMR Detection
The open source Mork library uses JSON-based templates to define the layout of forms inside Ruby applications. Each template describes the position, size, and type of each area (e.g., question blocks or answer boxes) on the sheet. This makes it easy to adapt the engine to various document designs. The following example shows how to achieve it. The JSON defines a 1-row, 4-column answer box labeled "Q1". You can position multiple blocks on a page to represent various questions.
How to Perform Template-Based OMR Operation via Ruby Library?
{
"name": "simple_form",
"page_width": 2480,
"page_height": 3508,
"elements": [
{
"type": "question_block",
"name": "Q1",
"x": 100,
"y": 200,
"width": 800,
"height": 100,
"rows": 1,
"cols": 4
}
]
Image Preprocessing and Detection via Ruby
The Mork library is very easy to handle and has provided complete support image pre-processing and OMR detection using Ruby commands. It includes built-in image processing to ensure accurate detection, including thresholding and binarization to handle different lighting conditions or scanning imperfections. In the following code example the library reads the scan, matches it with the template layout, and returns a Python dictionary of results based on filled-in bubbles or checkboxes.
How to Perform Image Preprocessing inside Ruby Apps?
from mork import omr
# Initialize the OMR engine with your template
scanner = omr.OMR(template_path="templates/simple_form.json")
# Analyze a scanned image
results = scanner.scan("scans/test_sheet.jpg")
# Print extracted answers
print(results)
High Flexibility and Customization
The Mork library represents a fascinating chapter in the history of open-source software. It was an ambitious attempt to create a lightweight and flexible data storage solution, and it powered popular applications for many years. You can define multiple question blocks, adjust answer sensitivity, and even customize how many marks per row are accepted. This is ideal for both single-answer (e.g., MCQs) and multi-answer (e.g., checkbox) formats.