Which free software can I use to deskew scanned images
Imagemagick has a -deskew option which may be helpful and the app works very well from the command line on batches of files.
There's some handy Imagemagick scripts here - have a look at unrotate.
The definitive tool is ScanTailor. It works like magic for fixing scanned pages and it has a Qt-based GUI frontend.
It allows for batch processing, manual verification and fix of every intermediate step (separation between pages, deskewing, content area identification, noise reduction and optimization) and it's available on every platform (Mac -- via MacPorts or Homebrew, Linux, Windows).
It takes as inputs JPG or TIFF files.
Maybe you want to see unpaper too.