Canon CanoScan LiDE 210 with SANE

From braindump
Jump to: navigation, search

Bought a Canon LiDE 210 the other day mainly because it was cheap enough and does get power over USB. That is one cable less to worry about.

Scanning Documents

After installing SANE and doing the first scan I was rather disappointed by the result. The pictures were dark and especially for document scans at high resolution the paper structure was clearly visible. It took a while to find a way to make the results decent enough to stick them into a PDF that looked pretty.

Eventually I ended up writing a wrapper script which picks up the scanned image modifies it and sticks it into a PDF. Below is a simplified breakdown of what the script does.

Scanning & Processing

For the scan I use the scanimage tool coming with SANE. For me the basic features worked ok but scanner specific options like brightness adjustment did not work.

scanimage -x 210 -y 297 --resolution 300 --format tiff --mode Color > SCAN.tif
Image 1: Clearly visible paper texture when scanning with scanimage

The first step of making the image more document like is with ImageMagick's mogrify or convert and the -despeckle option.

convert -despeckle SCAN.tif SCAN-despeckle.tif 
Image 2: ImageMagick's despeckle gets rid of the paper texture but leaves a "dirty" background

This gets rid of the paper structure but the image is still quite "dirty" the original paper is as white as snow. To get do the desired result the -brightness-contrast option will do with a value of 10x20.

convert -brightness-contrast 10x20 SCAN-despeckle.tif SCAN-despeckle-bc.tif
Image 3: Adjusting brightness and contrast gives the desired white background

Scanning into a PDF

With this out of the way combining the commands with a pipe and converting to PDF is quite easy.

scanimage -x 210 -y 297 --resolution 300 --format tiff --mode Color | \
  convert \( -despeckle -brightness-contrast 10x20 \) -repage A4 -compress jpeg -quality 90 - SCAN.pdf 

Voila, the PDF is ready.