Comments on How to take screenshots on Linux using Scrot
If you are looking for an even better command line utility for taking screenshots, then you must give Scrot a try. This tool has some extra features that are currently not available in gnome-screenshot. In this tutorial, we will explain Scrot using easy to understand examples.
6 Comment(s)
Comments
Great, Thanks!
Hi
I'm just trying to use scrot to capture screenshots by using a bash script. There I'm defining the destination folder in a variable, but it is not expanding. Hiere what I've done so far:
SCREENSHOT_DIR="/media/my_path"scrot '%d.%m.%Y_at_%H-%M-%S_$wx$h.png' -e 'mv $f $SCREENSHOT_DIR'
But the screenshot will be stored in a file called: 'SCREENSHOT_DIR'; howerver, I want to store it under:
/media/my_path/<screenshot_name>
Any clue on how to achieve this?
Thanks
best regardsJosef
Nevermind about my previous comment. I just found that you need to escape the '$' sign with backslash '\', ie:
SCREENSHOT_DIR=/media/my_path
scrot '%d.%m.%Y_at_%H-%M-%S_$wx$h.png' -e 'mv $f \$SCREENSHOT_DIR'
Now it works.
By the way, it must be done with export:
export SCREENSHOT_DIR=/media/my_path
scrot '%d.%m.%Y_at_%H-%M-%S_$wx$h.png' -e 'mv $f \$SCREENSHOT_DIR'
Otherwise it won't work
Sorry to bother you again, but I haven't found any help about this. Perhaps you have an idea.
I would like to have the following script:
export IMAGE_FORMAT=jpgIMAGE_QUALITY=50export DISPLAY=:0SCREENSHOT_DIR="/media/my_path"DAY=`date +'%d'`MONTH=`date +'%m'`YEAR=`date +'%Y'`export SAVE_TO_DIR="$SCREENSHOT_DIR/$YEAR.$MONTH.$DAY"mkdir -p "$SAVE_TO_DIR"scrot '%H.%M.%S_$wx$h.$IMAGE_FORMAT' -e 'mv $f \$SAVE_TO_DIR' -q $IMAGE_QUALITY -z
The problem here is the first argument: '%H.%M.%S_$wx$h.$IMAGE_FORMAT'. The $IMAGE_FORMAT won't be expanded and an error will appear:giblib error: Saving to file 13.21.26_1920x1080.IMAGE_FORMAT failed
Even if I try escaping the '$' sign: '%H.%M.%S_$wx$h.\$IMAGE_FORMAT' an error will appear:
giblib error: Saving to file 13.21.26_1920x1080.$IMAGE_FORMAT failed
Do you have any idea of achieving this?Thanks
Josef
Please try scrot with -s .... mouse "form-a-box"
scrot -s '%s.png' -e 'mv $f ~/Desktop/'
Problem: As I am forming the box, it suddenly 'jumps' to an 'L' or another shape. Seems to be time related???