Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: image-magick screenshot, a little script to take a screenshot< Next Oldest | Next Newest >
henk1955 Offline





Group: Members
Posts: 249
Joined: June 2004
Posted: Nov. 22 2004,11:33 QUOTE

Code Sample
#!/bin/bash

((cnt = 0))

#find a filename#
while [ -e $HOME/screenshot-$cnt.jpg ]; do
 # Increment cnt
 ((cnt++))
done

#give some time to take a pose
sleep 3

#shoot
/opt/imagemagick/bin/import -window root $HOME/screenshot-$cnt.jpg

i use this little script to take screenshot of my desktop
it needs the imagemagick.dsl
it will take a screenshot of the desktop and place a file screenshot#.jpg in the /home/dsl directory. everey time you take a new shot the filename is numbered up
you can create a menu item or desktop icon to "push the camera button"


--------------
You have a Q or just want to chat?
Come to #damnsmalllinux on irc.freenode.net!
Open 24/7

dell latitude c640 p4@1.6Ghz 256Mb DSL0.9.1-remaster
asus p4p800-vm p4@2.8Ghz HT / celeron@2.4Ghz 512Mb DSL0.9.1-remaster (alsadebs.dsl)
ABit BE6 celeron@466 256Mb DSL0.9.1-remaster (xawtv)
Back to top
Profile PM WEB MSN 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Nov. 22 2004,13:29 QUOTE

I have a similar script, but mine uses the current date as the filename.  I'll have to include $cnt so it no longer overwrites multiple same-day screenshots.  Thanks.

Also, ImageMagick has it's own pause option "-pause [# of seconds]"...no better than using sleep, but just thought I'd mention.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
AwPhuch Offline





Group: Members
Posts: 1404
Joined: April 2004
Posted: Nov. 23 2004,14:52 QUOTE

Outstanding...excellent

Great job guys!

Brian
AwPhuch


--------------
http://www.frappr.com/dsl <-- Where do you use DSL?
http://www.smoothwall.org <-- Ultimate firewall for the world!
http://boinc.mundayweb.com/one/stats.php/userID:6107 <--My BOINC stats!
./S99LinuxRevolution start
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Nov. 23 2004,16:29 QUOTE

Another addition is specifying compression as an argument:

if [ ! $1 ]; then
      echo "no compression specified (1-100)"
else    
import -pause 5 -window root -quality $1 ${FILENAME}
       if [ -r ${FILENAME} ]; then
       echo "image saved to ${FILENAME}"
       else
       echo "could not save ${FILENAME}"
       fi
fi

It would probably be better to have a default compression, but that's something that hadn't occured to me until about 14 seconds ago....

edit: So....

if [ ! $1 ]; then
echo "no compression specified (1-100)
assuming 90"
QUAL=90
else    
QUAL=$1
import -pause 5 -window root -quality $QUAL ${FILENAME}


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
3 replies since Nov. 22 2004,11:33 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: image-magick screenshot

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code