Registry / devops / deskew

deskew

JSON →
library1.6.1pypypi✓ verified 85d ago

Deskew is a Python library for detecting and correcting skew in images containing text. It uses OpenCV and scikit-image to compute the skew angle via projection profile or Hough transform methods. Current version: 1.6.1, requires Python >= 3.11. Releases are occasional.

pip install deskew
INSTALL
IMPORT
SIG · DESKEW
D
deskew
devopspythonv1.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

determine_skew
from deskew import determine_skew
from deskew.deskew import determine_skew
The old module path deskew.deskew was deprecated in v1.0.0

Detect skew angle in a grayscale image and rotate to correct.

import cv2 from deskew import determine_skew image = cv2.imread('input.png') grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) angle = determine_skew(grayscale) print(f"Skew angle: {angle}") # Rotate to correct (h, w) = grayscale.shape[:2] center = (w // 2, h // 2) M = cv2.getRotationMatrix2D(center, angle, 1.0) corrected = cv2.warpAffine(grayscale, M, (w, h), flags=cv2.INTER_CUBIC, borderMode=cv2.BORDER_REPLICATE) cv2.imwrite('output.png', corrected)
Debug
Known issues
breakingDeskew requires Python >= 3.11. Installation on older Python versions will fail.
fix
Upgrade Python to 3.11 or later.
affects: <1.6.0
gotchadetermine_skew expects a grayscale (single channel) image. Passing a BGR or RGB image will produce incorrect results or raise an error.
fix
Convert image to grayscale using cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) before passing to determine_skew.
affects: all
deprecatedThe module path deskew.deskew is deprecated since v1.0.0. Import directly from deskew instead.
fix
Use 'from deskew import determine_skew' instead of 'from deskew.deskew import determine_skew'.
affects: >=1.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'deskew'
Deskew library is not installed.
fix
Install using 'pip install deskew'
AttributeError: module 'deskew' has no attribute 'determine_skew'
Importing from wrong module path, e.g., 'from deskew.deskew import determine_skew'.
fix
Use 'from deskew import determine_skew'
cv2.error: OpenCV(4.9.0) ... error: (-215:Assertion failed) !ssize.empty() in function 'cv::cuda::HoughLinesDetector::detect'
Empty image (file not found or reading failed) passed to determine_skew.
fix
Ensure the image path is correct and the image is loaded properly: 'img = cv2.imread('path.jpg')' and check img is not None.
Upgrade
Version history
1.6.1latest on PyPI · released Jun 3, 2026
Audit
Dependencies
opencv-pythonrequiredCore image processing and deskew logic
scikit-imagerequiredUsed for determining image orientation
Agent activity
5 hits · last 30 days
node
4
Resources
deskew — pip install deskew · libregistry