LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs > LiquidSlumber
User Name
Password

Notices

Rate this Entry

Digital Camera Scanner

Posted 12-23-2005 at 07:36 PM by LiquidSlumber

Hey everybody I wrote the following script to basically turn my digital camera into semi-ok scanner. I've found it to be quite functional when used with a 3 MP digital camera. I hope it works for you too. It's been a while since I've written this script, but I think if you just change the 2 variables in the code that are flagged with "!!!!!!!!!!!!!!!!!!!!!", it should work just fine for you. Also you will need to have image magic installed on your computer.

---------------------------------------------------------------------------------------

#!/bin/bash -x

#this function takes in jpgs, flips them, resizes them, and prints them out.
function flipnprint ()
{
for i in $*
do
#rotates the pictures so that they all have the same orientation
nice mogrify -rotate "90>" "${temp}/${i}"
cp "${temp}/${i}" /media/usbdisk/OldPhotos
cp "${temp}/${i}" "${store}"
#resizes the image and stuff
nice -n19 mogrify -sharpen 2 -format ps -filter cubic -density 300x300 -geometry 2600x3350 "${temp}/${i}"
#prints the image
lpr -r "${temp}/${i%.jpg}.ps"
rm -f "${temp}/${i}"
done
}
#set sdhome to where ever the pictures are stored on your memory card!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sdhome=/media/usbdisk/dcim/100k7330

cd ${sdhome}
if (( $? != 0 ))
then
exit
fi

listofjpgs=$(echo *.jpg)


#checks to see if the sd card is mounted, and that it has new photos to process
if [ "${listofjpgs}" != "" ]
then
#change store to where you want the script to backup the photos it gets from the camera!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! store=/root/Desktop/Text\ Book\ Pages/Calculus\ TextBook\ Pages/$(date +"%B %d")
mkdir "${store}"
mkdir /tmp/copymachine
temp=/tmp/copymachine
mv ${sdhome}/$listofjpgs $temp
flipnprint ${listofjpgs}
else
exit 1
fi


Posted in Uncategorized
Views 688 Comments 0
« Prev     Main     Next »

  



All times are GMT -5. The time now is 06:08 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration