mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-09-30 11:23:55 +08:00
83679bd856
* selfdrive/assets: rasterize SVGs * do entire assets dir * fixed size - 4096px is a lot * optimise them too * use inkscape * regenerate * abandon runtime svg
24 lines
580 B
Bash
Executable File
24 lines
580 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
|
|
|
# sudo apt install inkscape
|
|
|
|
for svg in $(find $DIR -type f | grep svg$); do
|
|
bunx svgo $svg --multipass --pretty --indent 2
|
|
|
|
# convert to PNG
|
|
png="${svg%.svg}.png"
|
|
width=$(inkscape --query-width "$svg")
|
|
height=$(inkscape --query-height "$svg")
|
|
if (( $(echo "$width > $height" | bc -l) )); then
|
|
export_dim="--export-width=512"
|
|
else
|
|
export_dim="--export-height=512"
|
|
fi
|
|
inkscape "$svg" --export-filename="$png" $export_dim
|
|
|
|
optipng -o7 -strip all "$png"
|
|
done
|