Deskew Tools

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.

At the moment, Deskew is a command line tool for Windows, Linux, and Mac. Based on the user feedback and my own usage, I’d say it works quite well 🙂 On occasion, I think about stuff like: GUI for Deskew, Deskew app for Android, Deskew web app, and even Deskew Photoshop plugin!

All Posts About Deskew


  Deskew 1.20
» 4.1 MiB - 7,079 hits - January 5, 2011 (last update November 1, 2016)
Command line tool for deskewing scanned documents. Binaries for several platforms, test images, and Object Pascal source code included.

Source Code

Public Mercurial source repository of Deskew CLI tool is now hosted at BitBucket:

16 thoughts on “Deskew Tools

  1. I tried to use this amazing tool in ubuntu server 64 bit using deskew64 command line, I got the following error:
    ./deskew64: error while loading shared libraries: cannot open shared object file: No such file or directory

    Husam Haddad

      • Thank you, actually I have Ubuntu Server 12.04, in order to include libtiff5 package I have to upgrade at least to Ubuntu Server 12.10.

      • Unfortunately, there’s tiny API change going from libtiff4 to libtiff5. Deskew can work with only one of them – so I chose the newer one.

  2. Elegant, excellent. Thank you.

    The precompiled ../Bin/deskew works flawlessly under Linux openSUSE 13.1 64-bit.

    I’ll give you a plug on my site shortly.

    Thank you again.

    Cheers, Andy

  3. Nice program to deskew an image. Is there an option to generate the output with no loss in quality ? I have noticed that JPEGs get compressed to lesser quality.


      • Can you explain how to simply find the angle but not rotate using this tool? Since I’m dealing with archival TIFFs I need to keep the DPI and embedded metadata in place, so I’m thinking I would use ImageMagick to rotate once I have the angle. Thanks.

      • For now you could use -l parameter:
        -l angle: Skip deskewing step if skew angle is smaller
        And use some large threshold so rotation will always be skipped.

        $deskew -l 80 Sken003.png
        Preparing input image (Sken003.png) ...
        Calculating skew angle...
        Skew angle found: 0.23
        Skipping deskewing step, skew angle lower than threshold of 80.00

        For next version I plan to modify this: angle is optional and if omitted rotation is always skipped.

  4. Bug:
    When deskewing images and converting from one format to another (for example, from jpg to tif) if the source image is not deskewed (rotation angle smaller than the default 0.01) then the source image is simply copied to the output image without conversion to the appropriate format, which results in files with wrong extension.

    For example, running this command on an image that doesn’t need deskewing (can happen in batch files)

    deskew -t 200 -o image_001.tif -b FFFFFF image_001.jpg

    will simply copy image_001.jpg to image_001.tif WITHOUT actually converting it to TIFF format.

    The workaround at the moment is to specify -l 0 or to convert every file to destination format prior to deskewing.

    Other than this minor bug, deskew is an excellent program.
    Thank very much.

Leave a Reply

Your email address will not be published. Required fields are marked *