I don't think unpaper's deskew method works very well with music. However http://pagetools.sourceforge.net/ seems to work nicely at finding the skew angle....and others pages that were somewhat straight now skewed
Here's a script I just made to deskew a grayscale tiff using tiff_findskew and convert. It could be easily adjusted to work directly on b&w scans also. Perhaps unpaper could be used after this for further clean up.
Code: Select all
#!/bin/bash
PAGE_TOOLS_BIN=./
TIFF_FILE=$1
TIFF_BW_FILE=${TIFF_FILE%.*}-bw.tiff
TIFF_DESKEWED_FILE=${TIFF_FILE%.*}-deskew.tiff
#tiff_findskew require a monochrome image.
convert $TIFF_FILE -monochrome -compress Group4 $TIFF_BW_FILE
SKEW=`$PAGE_TOOLS_BIN/tiff_findskew $TIFF_BW_FILE`
#Negate the skew to correct it.
SKEW=`echo " - $SKEW" | bc`
#perform the rotation
convert $TIFF_FILE -distort SRT "0,0 1.0 $SKEW 0,0" $TIFF_DESKEWED_FILE