Deskew is a tool for deskewing scanned text documents. Deskewing is a term used for fixing the scans to get the lines of text straight. That means rotating the image of the scanned page a little to compensate for the misalignment of the paper in the scanner.
Deskew uses Hough transform to detect "text lines" in the image and their orientation. As an output, you get an image rotated so that the detected lines are horizontal. You can find more theory in introductory post Deskewing Scanned Documents if you are curious.
Deskew is a command line tool for Windows, Linux, and macOS. Simple GUI frontend also exists. Based on the user feedback and my own usage, I'd say it works quite well 🙂 On occasion, I think about stuff like: Deskew web app, GPU deskewing, Deskew app for Android, and even Deskew Photoshop plugin!
All Posts About Deskew
- Deskew CLI Tool v1.30 Released Posted on: June 19, 2019
- GUI Frontend for Deskew Posted on: December 4, 2018
- Deskew Tool v1.25 Released Posted on: May 23, 2018
- Deskew Tool v1.20 Released Posted on: November 29, 2016
- Deskew Tool Version 1.10 Posted on: March 7, 2014
- Deskew Tool Updated Posted on: June 6, 2012
- Deskewing Scanned Documents Posted on: January 5, 2011
Command line tool and GUI frontend downloads:
» 4.3 MiB - 18,644 hits - June 19, 2019
Command line tool for deskewing scanned documents. Binaries for several platforms, test images, and Object Pascal source code included.
» 4.1 MiB - 5,200 hits - March 18, 2019
GUI frontend for Deskew command line tool. Prebuilt binaries for Windows, macOS, and Linux. Windows and Linux versions need Deskew command line tool binaries.
Bug Reports & Feature Proposals
Please report bugs and propose enhancements and new features in Deskew's issue tracker:
Deskew's sources are hosted here:
If you want to donate to Deskew Tools you can click Sponsor button at Deskew's GitHub page.
Deskew 1.10 (2014-03-03) by Marek Mauder
Preparing input image (1.tif) …
EInvalidOp: Invalid floating point operation
What have I done wrong?
Please try with the current version Deskew 1.30.
Hi Marek, thank you for such a useful and reliable utility. I don’t know if you still have time to maintain Deskew and DeskewGui, but some options like the JPEG compression quality are missing from the GUI and because of that, one has to write some batch files/scripts to process entire folders of scanned pages. Either offering in the GUI all the available options or a line to pass extra options would do the trick. Thanks for your consideration.
Compression settings are actually already implemented but there’s no official build released.
Good idea to allow passing extra parameters from GUI to CLI. GUI will always
lag behind a bit and won’t provide all the options CLI can handle.
Oh, Marek, one more thing… When I run the Deskwe tool on some JPGs, the pixel density (DPI) is changed from say 300 DPI to 72 DPI and the page appears of wrong dimensions when later imported into Adobe Acrobat. Is this something you could quickly fix?
I suspect it’s this issue https://github.com/galfar/deskew/issues/11. No quick fix for this unfortunately.
Hi Marek, did you get my email?
Hi Marek, thank you for your DeskTools, I like it 🙂 Is there any way, how to skew multipage TIF (BW, with G4) scan?
Hi, TIFF multipage support is planned (https://github.com/galfar/deskew/issues/10), in the meantime the pages need to be extracted to individual files (ImageMagick, …).G4 is supported on input, on output you need to force output to 1bit (“-f b1”).
First I’d like to say this is one of the best deskew CLI I’ve used to date. Everything is simple and does what is intended. Some things like DPI and Color Profile do get dropped in the output but I use another CLI to fix those two things (ExifTool and ImageMagick.)
One request if at all possible is can there be an option for -b that auto samples the rgb value of an edge. I currently run an auto-crop script after they are deskewed and some pages have a different background color. This sometimes trips up the auto crop into thinking the added background is an edge. I’m hoping for something a little more dynamic that allows me to use the tool without sorting the material first.
Hi, you mean something like “look at pixel [0,0] of input image and use it for output background”?
Yes. “look at pixel [0,0] of input image and use it for output background” would be a great additional feature.
I’ve created a task for this: https://github.com/galfar/deskew/issues/39
I apologize if this is a very n00b question, but is there anyway to deskew PDFs instead of image files?I keep getting errors whenever I put in my PDF documents into Deskew GUI.
I’ve tried to circumvent this by convert the individual pdf pages into separate images, then running Deskew on those image files and putting them back together as a pdf, but the quality from converting pdf to image is pretty poor.
Hi, what did you use to convert PDF to images?
Is there an exit code for deskew.exe to determine if it was successful or failed?
Usually this is a 0 or 1 but sometimes there are multiple exit codes. Is this documented somewhere on Github?
Yes, there’s usual exit code 0 for success and 1 for failure.