Files
music_quiz/assets/brand/render.sh
2026-10-18 17:03:33 +09:00

8 lines
473 B
Bash
Executable File

#!/bin/bash
# usage: render.sh in.svg out.png size
in=$(realpath "$1"); out=$(realpath -m "$2"); s=$3
tmp=$(mktemp --suffix=.html -p "$HOME/.tmp")
echo "<html><body style='margin:0;background:transparent'><img src='file://$in' width=$s height=$s style='display:block'></body></html>" > "$tmp"
google-chrome --headless=new --disable-gpu --hide-scrollbars --default-background-color=00000000 --window-size=$s,$s --screenshot="$out" "file://$tmp" >/dev/null 2>&1
rm -f "$tmp"