Skip to content

Commit

Permalink
Add bash scripts for capturing screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
ubruhin committed Feb 10, 2017
1 parent 52dc0d2 commit 843cdae
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
31 changes: 31 additions & 0 deletions dev/capture_overview_screenshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Helper script to capture screenshots of LibrePCB windows.
# Requirements: sudo apt-get install wmctrl shutter imagemagick
# Note: Enable round corners in shutter preferences!

set -euo pipefail

WIDTH=800
HEIGHT=500
X1=100
X2=280
X3=460
Y1=100
Y2=250
Y3=400

# capture screenshots
wmctrl -a "Control Panel" && wmctrl -r "Control Panel" -e 0,$X1,$Y1,$WIDTH,$HEIGHT
shutter -w="Control Panel" -o control_panel_small.png -d 3 -c -e
wmctrl -a "Board Editor" && wmctrl -r "Board Editor" -e 0,$X2,$Y2,$WIDTH,$HEIGHT
shutter -w="Board Editor" -o board_editor_small.png -d 3 -c -e
wmctrl -a "Schematic Editor" && wmctrl -r "Schematic Editor" -e 0,$X3,$Y3,$WIDTH,$HEIGHT
shutter -w="Schematic Editor" -o schematic_editor_small.png -d 3 -c -e

# merge screenshots together
convert -page +$X1+$Y1 control_panel_small.png \
-page +$X2+$Y2 board_editor_small.png \
-page +$X3+$Y3 schematic_editor_small.png \
-background transparent -layers merge +repage overview_small.png

23 changes: 23 additions & 0 deletions dev/capture_screenshots.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Helper script to capture screenshots of LibrePCB windows.
# Requirements: sudo apt-get install wmctrl shutter imagemagick
# Note: Enable round corners in shutter preferences!

set -euo pipefail

function capture_screenshot {
echo "----- NEXT WINDOW: $1 -----"
sleep 5
wmctrl -a "$1" && wmctrl -r "$1" -e 0,100,100,1100,650
shutter -w="$1" -o "$2" -d 3 -c -e
convert -thumbnail 770x455 "$2" "thumbs/$2"
}

capture_screenshot "Control Panel" "control_panel.png"
capture_screenshot "Board Editor" "board_editor.png"
capture_screenshot "Schematic Editor" "schematic_editor.png"
capture_screenshot "Add Component" "add_component_dialog.png"
capture_screenshot "Library Manager" "library_manager.png"
#capture_screenshot "Library Editor" "library_editor.png"

0 comments on commit 843cdae

Please sign in to comment.