deskew
Skew detection and correction in images containing text
What it is and what it does
Deskew is a Python library that detects and corrects image skew—the rotation angle of text or documents in images. It analyzes grayscale images to determine the rotation angle (between -45 and 45 degrees by default, or -90 to 90 with the `angle_pm_90` option) and returns that angle for use in downstream rotation. The library works with both scikit-image and OpenCV workflows, accepting numpy arrays and integrating into standard image processing pipelines.
The package is designed for document scanning, OCR preprocessing, and text image normalization. It depends on numpy for numerical operations and scikit-image for image manipulation, making it lightweight and suitable for batch processing. A CLI tool is also provided for quick angle detection or direct deskewing of image files, and optional debug output is available to tune detection parameters when results are suboptimal.
Use it for:
- Preprocess scanned documents for OCR by detecting and reporting their rotation angle
- Straighten photographs of text-heavy documents before feeding to text recognition systems
- Batch-correct skewed images in document digitization pipelines
- Detect rotation angle in document images without rotating, for logging or analysis
- Integrate skew correction into image processing workflows using scikit-image or OpenCV
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Detects and corrects image skew (rotation) in documents and text-containing images by calculating the rotation angle and providing tools to straighten them.
Yes. Deskew solves a specific, well-defined problem (skew detection in text images) with low install friction, active maintenance, no known vulnerabilities, and a permissive MIT license. It is suitable for document processing and OCR preprocessing workflows. Install it if you need to detect or correct image rotation in text-heavy documents.
Install
deskew on PyPI
pip
pip install deskewuv
uv add deskewpoetry
poetry add deskewInstalling deskew
Before you install
Low friction: pure Python wheel with only numpy and scikit-image as runtime dependencies. Active maintenance with recent release (72 days ago) and 524 repository stars.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal attribution requirements.
Quickstart
pip install deskew
from deskew import determine_skew
import numpy as np
from skimage import io
from skimage.color import rgb2gray
from skimage.transform import rotate
image = io.imread('input.png')
grayscale = rgb2gray(image)
angle = determine_skew(grayscale)
rotated = rotate(image, angle, resize=True) * 255
io.imsave('output.png', rotated.astype(np.uint8))
Requires Python 3.11 or later
Verify before relying
- Accuracy of skew detection across different document types, resolutions, and languages
- Performance characteristics on large batches or high-resolution images
- Whether the debug_images extra dependency set is necessary for typical use cases
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — numpy, scikit-image |
| Maintenance | actively maintained — 72 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 79,574/month — #14,349 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: deskew-1.6.1-py3-none-any.whl
Tags
More Information Analysis packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyarrowpyarrow provides Python bindings to Apache…
permissive · top 100 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
snowflake-snowpark-pythonSnowpark Python provides APIs to query and…
permissive · top 1,000 on PyPI
qrdetDetects and segments QR codes in images using a…
permissive · top 15,000 on PyPI
rembgRemoves image backgrounds using deep learning…
permissive · top 5,000 on PyPI
scikit-imagescikit-image provides algorithms for image…
permissive · top 1,000 on PyPI
imutilsimutils provides convenience wrappers around…
unclear · top 15,000 on PyPI
imgaugAugments images and related data (heatmaps,…
permissive · top 5,000 on PyPI
qreaderQReader detects and decodes QR codes from…
permissive · top 15,000 on PyPI
pyquaternionProvides quaternion representation,…
permissive · top 5,000 on PyPI
PyWinBoxPyWinBox manages window positions, sizes, and…
permissive · top 15,000 on PyPI
ocrmypdfOCRmyPDF adds searchable text layers to scanned…
copyleft · top 5,000 on PyPI
python-doctrpython-doctr extracts and localizes text from…
permissive · top 15,000 on PyPI