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
Downloads
Command line tool and GUI frontend downloads:
Deskew v1.30
» 4.3 MiB - 20,632 hits - June 19, 2019
Command line tool for deskewing scanned documents. Binaries for several platforms, test images, and Object Pascal source code included.
DeskewGui v0.90
» 4.1 MiB - 6,296 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:
https://github.com/galfar/deskew/issues
Source Code
Deskew's sources are hosted here:
https://github.com/galfar/deskew
Donation
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
http://galfar.vevb.net/deskew/
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?
Thanks.
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”).
Hi Marek,
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
Hello,
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?
Thanks.
Yes, there’s usual exit code 0 for success and 1 for failure.
Marek, thank you for this app.
But my input file is a Black and White TIF [compression: CCITT Group 4 (2d) fax]
The output file generated by your “deskew app” is a gray scale file , whose size is 10 times the size of the input file.
It is true that of course, I can paste the content of the gray scale file into the original B&W file and reduce the size to a value close to the original size.
But it would be nice if your “deskew” could output a file in the same format as the input file.
Hi, you can pass “-f b1” argument to force output to 1bit and then G4 compression will be used automatically for TIFFs.
Or with the latest version on GitHub pass “-c tg4” to force G4 or “c -tinput” to use compression from the input.