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

From braindump
Jump to navigation Jump to search
Line 8: Line 8:
scanimage -x 210 -y 297 --resolution 300 --format tiff --mode Color > scan.tif
scanimage -x 210 -y 297 --resolution 300 --format tiff --mode Color > scan.tif


[[File:Canon_LiDE_210-Scan-Raw.png|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 scan.tif scan-despeckle.tif


[[File:Canon_LiDE_210-Scan-Despeckle.png|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 scan-despeckle.tif scan-despeckle-bc.tif


[[File:Canon_LiDE_210-Scan-Despeckle-BC.png|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" />


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

Revision as of 23:16, 11 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.

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.