Linux Blog

Automated scanning with the shell

Filed under: Shell Script Sundays — TheLinuxBlog.com at 9:25 am on Sunday, July 27, 2008

I recently needed to scan a lot of images on my desktop PC. Unfortunately I am not the owner of an automatic document feed printer, and if I were it wouldn’t have helped this time because the documents I needed to scan were not feed able. XSANE is a great way to scan documents visually in Linux. Its not the easiest to use, but it has plenty of options. Part of the SANE package is scanimage, scanimage can be used from the shell.

The first thing that I did was a few test images with scanimage. I quickly found out that scanimage outputs in pnm format, and at a high resolution if the correct options are used. Once I found out the good options for my scanner (scanimage –resolution 400 > file.pnm) I wrote a quick shell script to scan up to 1000 times or until I don’t give the script any input. To do this, I used a combination of snippets that can be found in this blog column.

Here is a direct link to the script, and the shell script source below

#!/bin/bash
for i in `seq 1 1000`; do
 
#get input line
read inputline;
 
if [ $inputline ]; then
 
#Process Scanned Image in BG
echo Scanning Pg$i;
scanimage --resolution 400 > Pg$i.pnm;
echo Next;
else
exit
fi
 
done;

To use it all I do is execute the script, and I get to scan up to 1000 documents providing I type something after it prompts “Next”, and then hit enter. Once I was done scanning, I just hit enter to stop the script execution and then moved on to manipulating the images with the shell.

Hope this shell script scanning script is useful, if it is then drop me a comment, or if you have any suggestions or it was not at all helpful still drop me a comment.

The Linux Blog | New Category Added

Filed under: Linux Video Tutorials,The Linux Blog News — TheLinuxBlog.com at 3:00 am on Friday, February 1, 2008

I posted a Linux Video Tutorial on How to Partition Slackware earlier this morning. This is a follow up post, basically the point is I think that I’m going to test the waters in creating Linux Video Tutorials. A certain amount of effort goes into creating these videos and since I’m no video editing whiz it will probably be a slow building category. I’d like as much support as possible with this, those around me seem to think that it could do well and are impressed with the results but unfortunately when I upload them to YouTube its a different story. The quality of the How to partition Slackware video very poor. So in retaliation I am working on getting the necessary bandwidth to support high resolution videos. Stay Tuned for more information on these Linux Video Tutorials!

In other news January 2008 has been the best month for me so far. I would like to take a moment to thank everybody that visits on a regular basis for reading and ask for more comments. I havn’t made any money from this site yet (and nor do I plan to make masses) but feedback is always appreciated.

I’m looking for people to help with the daily blogging on Linux technologies so, if your interested shoot me an e-mail at owen -at- thelinuxblog.com