imagemagick-convert

How to deskew a scanned text page with ImageMagick?


I have scanned documents that weren't scanned perfectly straight so the text is not orientated perfectly horizontally, i.e. perhaps 10° of a slope on each line.

My understanding is that the deskew option in ImageMagick should solve this, for example

convert skewed_1500.jpeg -deskew 40% skewed_1500_not.jpg

but it doesn't have any noticeable effect on the output file.

I've attached the skewed and deskewed images for comparison.

First the original image: skewed image

Then the purportedly deskewed image: deskewed image


Solution

  • I would try a bigger value like 80% otherwise an Imagemagick forum member has a bash script that may be better: http://www.fmwconcepts.com/imagemagick/textdeskew/index.php