chore: refresh feature graphic

This commit is contained in:
Harsh Shandilya 2024-01-23 20:22:53 +05:30
parent 61307bdf03
commit 2c0c97d6cc
3 changed files with 19 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 KiB

After

Width:  |  Height:  |  Size: 261 KiB

View File

@ -9,30 +9,40 @@ SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
SCREENSHOT_DIR="${SCRIPT_DIR}"/../screenshots
function generate_grid() {
local MONTAGE_INPUT BACKGROUND_COLOR OUTPUT_FILE
MONTAGE_INPUT="$(mktemp)"
OUTPUT_FILE="${1:?}"
BACKGROUND_COLOR="${2:?}"
# Run the Maestro flow to generate the screenshots
"${SCRIPT_DIR}"/run-maestro-flows.sh feature_graphic.yml
# Use imagemagick to stitch the screenshots in a grid
montage -tile 3x0 -geometry +0+0 \
-border 0 -density 300 \
# Fill out the input files with padding
printf "%s\n%s\n%s\n%s\n%s\n%s\n" \
"${SCREENSHOT_DIR}"/HottestPosts.png \
"${SCREENSHOT_DIR}"/CommentsPage.png \
"${SCREENSHOT_DIR}"/SavedPosts.png \
"${SCREENSHOT_DIR}"/SearchPage.png \
"xc:${BACKGROUND_COLOR}" \
"${SCREENSHOT_DIR}"/SettingsPage.png \
"${1:?}.png" || true
>> "${MONTAGE_INPUT}"
# Use imagemagick to stitch the screenshots in a grid
# Dimensions are of my Pixel 4a which I use for this purpose
montage @"${MONTAGE_INPUT}" -tile 3x0 -geometry 1080x2340+0.0! \
-border 0 -density 300 \
"${OUTPUT_FILE}.png" || true
# Convert the resulting PNG to WebP
cwebp "${1:?}.png" -o "${1:?}.webp"
cwebp "${OUTPUT_FILE}.png" -o "${OUTPUT_FILE}.webp"
# Remove the now-useless PNG
rm "${1:?}.png"
# Remove the now-useless PNG and montage input text
rm "${OUTPUT_FILE}.png" "${MONTAGE_INPUT}"
}
adb shell "cmd uimode night no"
generate_grid "${SCRIPT_DIR}"/../.github/readme_feature_light
generate_grid "${SCRIPT_DIR}"/../.github/readme_feature_light white
adb shell "cmd uimode night yes"
generate_grid "${SCRIPT_DIR}"/../.github/readme_feature_dark
generate_grid "${SCRIPT_DIR}"/../.github/readme_feature_dark black