Skip to content

Instantly share code, notes, and snippets.

@zorbash
Created August 28, 2015 16:45
Show Gist options
  • Select an option

  • Save zorbash/ee0c491de912cf4e37b7 to your computer and use it in GitHub Desktop.

Select an option

Save zorbash/ee0c491de912cf4e37b7 to your computer and use it in GitHub Desktop.
fname=/home/zorbash/Pictures/interval/`date +"%m_%d_%y_%H%M%S"`
fswebcam -r 640x480 --jpeg 85 ${fname}.jpg
convert ${fname}.jpg -resize 1920x1080 ${fname}.jpg
export DISPLAY=:3
scrot ${fname}s.jpg
montage -mode concatenate -tile 1x ${fname}s.jpg ${fname}.jpg ${fname}_combined.jpg
@carolinux
Copy link

A more general solution:

ts=`date +"%m_%d_%y_%H%M%S"`
PIC_DIR=/home/carolinux/Pictures/Webcam
webcam_file=$PIC_DIR/$ts.jpg
screenshot_file=$PIC_DIR/${ts}s.jpg
joined_file=$PIC_DIR/joined/${ts}.jpg

fswebcam -r 640x480 --jpeg 85 -D 1 $webcam_file
export DISPLAY=:0.0
xwd -root | convert - $screenshot_file

webcam_width=`identify -format "%[fx:w]" ${webcam_file}`
screenshot_width=`identify -format "%[fx:w]" ${screenshot_file}`

scale=` echo "100.0 * ${webcam_width}/${screenshot_width}"|bc`

mogrify -scale ${scale}% $screenshot_file

convert $webcam_file $screenshot_file -append $joined_file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment