Wed, 03 Dec 2008

Ubuntu and Scanning

Keywords: linux ubuntu 8.10 intrepid ibex sane hp scanjet 5370C avision

Another of the things that broke when I upgraded Ubuntu to 8.10 was the scanning. To be fair, it had barely been working since the upgrade to 8.04, but with 8.10 scanimage just crashed. I debugged it a little and discovered that by uncommenting "option disable-calibration" in /etc/sane.d/avision.conf I could avoid the crash, but after scanning in one direction the scanner wouldn't return to its resting position.

Eventually, I decided that if I was going to fix the crash I'd have to build a debugging version of the code, and that if I was going to do that I should get the latest version available. It turns out that was in a CVS repository and was fairly easy to obtain and build:

cvs -z3 co sane-backends
./configure --sysconfdir=/etc --prefix=/usr/local/pkg/sane
make install

And BINGO! The crash was fixed, and I didn't had to change any code at all.

I still had the problem, which was also there in 8.04, that the preview in xsane has diagonal stripes. Do I decided to do away with xsane and replace it by a small shell script which I imaginatively named scan:



/usr/local/pkg/sane/bin/scanimage -d avision -v -p --resolution=300 "$@" > /tmp/out.pnm
convert -quality 90 -verbose /tmp/out.pnm $out
gimp $out

So now, when I scan album art, for example, (which is what I most commonly scan nowadays), I can just type scan front.jpg and the cover is scanned and thrown up in gimp for me to crop and save. This has been working well so far.

[/unix] permanent link

October 2020
Sun Mon Tue Wed Thu Fri Sat