Deskew not working
Brought to you by:
ra28145
Thank you for a great piece of software. I'm not a programmer and moved from Windows to Linux (Mint Cinnamon) as it feels tidier and less bloated than Windows. However, there is a disinct lack of scanning software running natively under Linux and yours is the best I have found for my needs. Unfortunately, the deskew option doesn't appear to be working. I uninstalled and reinstalled unpaper, but that did not help. I have attached an example of a scanned receipt which I then applied Tools/Cleanup/Deskew to with Deskew to Top and Left selected. The result was the same. If you are able to provide a solution, that would be greatly appreciated.
I am not the author or maintainer of unpaper. Perhaps you could report the problem to the current developer:
https://www.flameeyes.eu/projects/unpaper
In the mean time, I suspect the problem is that it is very skewed. I have used unpaper succesfully to deskew scanned documents, but could not in your case, either. I imagine it does not recognise skew angles above a certain tolerance.
Perhaps you could use an imagemagick script like this. You could run it as a user-defined tool from gscan2pdf:
http://www.fmwconcepts.com/imagemagick/unrotate/index.php
Last edit: Jeffrey Ratcliffe 2017-05-26
Thank you for your reply. I have attached another file which is less skewed and that is not corrected using unpaper through gscan2pdf either. The deskew option used to work for me, but I think I may have broken it somehow.
I checked out the unrotate script at Fred's page. Looks complicated from a novice standpoint but I imagine it's straightforward for programmers. You'll laugh at my attempt to get it working in gscan2pdf:
Edit/Preferences/General options and then under Manage user-defined tools I added "unrotate %i %o ". Then, with my skewed image loaded, I went to Tools/User-defined and selected Page range "All" and Selected tool "unrotate %i %o". The following error message was then displayed:
"Error creating file in /tmp/gscan2pdf-nkMA: open3: exec of unrotate /tmp/gscan2pdf-nkMA/oqxsjqPBPD.png /tmp/gscan2pdf-nkMA/OnkubjbCap.png failed at /usr/share/perl5/Gscan2pdf/Document.pm line 1860 thread 1."
Thanks for your time. I know the above is a rolling-of-the-eyeballs moment.
I currently use Scan Tailor as well to straighten documents out. That appears to be very good at what it does. If gscan2pdf and Scan Tailor were part of the same package, that would be very powerful.
With a bit of playing around, I could convince unpaper to deskew this example. Normally, I set to deskew to the top and left edges, but this produced an error message (that I admit gscan2pdf failed to display). Setting it to deskew just to the left edge produced the desired result.
In order to use user-defined tools like Fred's unrotate script, you first have to make them available on your system. Download it, and save it, for instance, under $HOME/scripts/unrotate
Then use the complete $HOME/scripts/unrotate path in Edit/Preferences when telling gscan2pdf about it.
Don't worry about asking questions - we were all newbies once.
I added the location of unrotate following your instructions and have attached 4 images showing what happened.
I also tried using unpaper again in gscan2pdf using just deskew to left edge. This didn't work. I'm pretty sure I broke something some time ago as I remember deskew working correctly in the program.
Thanks again.
Did you make the unrotate script executable?
Assuming that it doesn't change the file inplace, the call should be:
I didn't realise I needed to make the unrotate script executable. I have now made it executable and updated the call in gscan2pdf as advised.
The script now appears to run. However, it appears to skew the original image further rather than deskew the image. I do like the auto crop feature though. Before and After images attached.
Well, it seems that you have managed to get the script working. You might look for help:
http://www.fmwconcepts.com/imagemagick/
or ask the author:
fmw at alink dot net