webui_capture.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. # -----------------------------
  3. # Configuration
  4. # -----------------------------
  5. URLS=(
  6. "http://localhost:5287"
  7. "http://localhost:5287/hardware/tree"
  8. "http://localhost:5287/servers/list"
  9. "http://localhost:5287/resources/hardware/proxmox-node01"
  10. )
  11. RESOLUTION="1366,768" # width,height
  12. OUTPUT_DIR="./webui_screenshots"
  13. GIF_OUTPUT="webui_screenshots/output.gif"
  14. DELAY=200 # delay between frames in GIF (ms)
  15. # -----------------------------
  16. # Prepare output folder
  17. # -----------------------------
  18. mkdir -p "$OUTPUT_DIR"
  19. # -----------------------------
  20. # Capture screenshots
  21. # -----------------------------
  22. echo "Capturing screenshots..."
  23. for URL in "${URLS[@]}"; do
  24. # sanitize filename
  25. FILENAME=$(echo "$URL" | sed 's~http[s]*://~~; s~/~_~g').png
  26. echo " - $URL -> $FILENAME"
  27. # headless Chrome screenshot
  28. /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
  29. --headless \
  30. --disable-gpu \
  31. --window-size=$RESOLUTION \
  32. --screenshot="$OUTPUT_DIR/$FILENAME" \
  33. "$URL"
  34. done
  35. # -----------------------------
  36. # Convert to GIF using ImageMagick
  37. # -----------------------------
  38. echo "Creating GIF..."
  39. convert -delay $DELAY -loop 0 "$OUTPUT_DIR"/*.png "$GIF_OUTPUT"
  40. echo "Done! GIF saved to $GIF_OUTPUT"