What is Deskewing?
Deskewing corrects a small angular tilt in scanned text or document images so that lines align with the intended horizontal or vertical direction. It is different from rotating a sideways page by 90 degrees.
How Deskewing works
A deskewing process estimates an angle from text lines, edges, or another structural cue, rotates the image, and resamples its pixels onto a new grid. The operation may add borders or crop corners, depending on its canvas policy. A photograph of a page can also contain perspective distortion, which requires a geometric correction beyond a single rotation. Sparse text and decorative layouts can make angle estimation unreliable.
Key facts
- Deskewing and orientation detection solve different problems. An upright page may be tilted slightly, while a perfectly straight page can still be upside down.
- Rotation resamples raster content. Repeated deskewing can soften fine text, so apply a deliberate correction rather than a chain of successive guesses.
- A straighter page is not automatically an accurate OCR result. Resolution, contrast, language, layout, and damaged characters still affect recognition.
When Deskewing matters
Deskew tilted scans before OCR when the tilt interferes with line segmentation. Inspect the result for cropped characters and preserve the source image for comparison.