Emulating Adobe Reader's Snapshot tool in Ubuntu

In this post I presented a simple python script for copying image files to the gnome clipboard. In this post, I'll show how I use this script with imageMagik to emulate the snapshot tool in Adobe Reader. I originally wanted to use this just for Evince (default Ubuntu document reader) but have found all kinds of situations where it's handy outside of Evince.

The end goal here is to have a key binding which, when pressed, starts a "selection mode" where any part of the screen can be selected. That selection is then copied to the gnome clipboard so that it can be pasted into a document (i.e. a libreoffice or openoffice document, though I usually use it to paste into Xournal).

The script

Here is the script I use to do just that.


#prefix for filename
timestamp=`date '+%d-%m-%y-%N'`;


import $file
python $HOME/Codes/python/imgclip/imgclip.py $file

The import tool is part of the imageMagik package. It does the screenshot taking part, by changing the mouse cursor to a "selection" tool. It saves the screenshot in /tmp/screenshot_TIMESTAMP.png where the timestamp is generated by the date command. The script then runs imgclip to copy the screenshot to the clipboard. I have this script bound to a command in compiz. The command is

bash $HOME/Codes/shell/screenshot/screenshot.sh

Here is a screencast of it in action:


Comments powered by Disqus