Taking a screenshot of a specific area on the screen once per second

I would like to be able to take screenshots of a certain area on the screen once a second and have a file called MMDDYYYYHH: MM: ss this is possible using the command line and the program. I thought to use a script like this

for((i=0;i<1000;i++)) do import -window root screenshot-$(date '+%d%b%y-%N').png sleep 5m done 

But I do not know the commands to access the program, to change the area on the screen and limit the image quality when saving to a file. PS: I am ready to use another program if it works. I am using Linux Ubuntu 10.04 64 bit.

thanks

+4
source share
3 answers

You can use the -crop WxH+X+Y option for the import command. To indicate the area of ​​the screen. And the -quality parameter for the quality / level of output compression. Something like that:

 import -window root -crop 200x300+100+15 -quality 100 $(date +%Y%m%d-%H%M%S).png 

Please note that the -quality parameter for the .png and .jpg format has almost opposite values: a value of 10 for png means “less compression” (larger size), and a value of 100 means maximum compression (minimum size), On the other hand, a value of 10 for jpg means "lower quality" (smaller size), and a value of 100 means "maximum quality" (maximum size).

+8
source

Here is what I used, anyway it can help the next person. I used Shutter (screengrab) and selected the Selection option to get the correct coordinates and put them in the script below.

 #!/bin/bash for((i=1;i<10;i++)) do import -window root -crop 454x394+69+269 -quality 200 $(date +%m%d%Y-%H%M%S).png echo $i #type this in a terminal to run ./timed.sh sleep 1 done 
+2
source

Have you tried using Linux alternatives for screenshots?

These are: Shutter , ScreenGrab , FireShot ...

0
source

Source: https://habr.com/ru/post/1382442/


All Articles