SANE/Canon CanoScan LiDE 210

From braindump
Revision as of 23:07, 11 May 2012 by Uroesch (talk | contribs)
Jump to navigation Jump to 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.

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.

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


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.