Difference between revisions of "SANE/Canon CanoScan LiDE 210"

From braindump
Jump to navigation Jump to search
Line 8: Line 8:
=== Scanning & Processing ===
=== Scanning & Processing ===
For the scan I use the <tt>scanimage</tt> tool coming with SANE. For me the basic features worked ok but scanner specific options like brightness adjustment did not work.
For the scan I use the <tt>scanimage</tt> 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
scanimage -x 210 -y 297 --resolution 300 --format tiff --mode Color > <span class="input">SCAN.tif</span>


[[File:Canon_LiDE_210-Scan-Raw.png|link=|left|frame|Image 1: Clearly visible paper texture when scanning with <tt>scanimage</tt>]] <br style="clear: both" />
[[File:Canon_LiDE_210-Scan-Raw.png|link=|left|frame|Image 1: Clearly visible paper texture when scanning with <tt>scanimage</tt>]] <br style="clear: both" />


The first step of making the image more document like is with ImageMagick's <tt>mogrify</tt> or <tt>convert</tt> and the <tt>-despeckle</tt> option.
The first step of making the image more document like is with ImageMagick's <tt>mogrify</tt> or <tt>convert</tt> and the <tt>-despeckle</tt> option.
convert -despeckle scan.tif scan-despeckle.tif
convert -despeckle <span class="input">SCAN.tif SCAN-despeckle.tif</span>


[[File:Canon_LiDE_210-Scan-Despeckle.png|link=|left|frame|Image 2: ImageMagick's despeckle gets rid of the paper texture but leaves a "dirty" background]] <br style="clear: both" />
[[File:Canon_LiDE_210-Scan-Despeckle.png|link=|left|frame|Image 2: ImageMagick's despeckle gets rid of the paper texture but leaves a "dirty" background]] <br style="clear: both" />


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 <tt>-brightness-contrast</tt> option will do with a value of <tt>10x20</tt>.
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 <tt>-brightness-contrast</tt> option will do with a value of <tt>10x20</tt>.
convert -brightness-contrast 10x20 scan-despeckle.tif scan-despeckle-bc.tif
convert -brightness-contrast 10x20 <span class="input">SCAN-despeckle.tif SCAN-despeckle-bc.tif</span>


[[File:Canon_LiDE_210-Scan-Despeckle-BC.png|link=|left|frame|Image 3: Adjusting brightness and contrast gives the desired white background]] <br style="clear: both" />
[[File:Canon_LiDE_210-Scan-Despeckle-BC.png|link=|left|frame|Image 3: Adjusting brightness and contrast gives the desired white background]] <br style="clear: both" />

Revision as of 00:04, 14 May 2012

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.

References