#!/bin/sh # Renders an app's product page header: three iPhone screenshots fanned over a background, as # header-21x9.png (3840x1646) and header-16x9.png (5244x2950), with headless Chromium and the # alpha channel removed. # Usage: render-header.sh # The directory holds screenshots/iphone-6.9/ and header.conf, which sets: # background the CSS background # left center right the screenshots' names in screenshots/iphone-6.9, without .png # extra_css optional: CSS after the shared rules # CHROMIUM the Chromium binary (default /Applications/Chromium.app/Contents/MacOS/Chromium) set -eu dir="$(cd "${1:?usage: render-header.sh }" && pwd)" extra_css= . "$dir/header.conf" chromium="${CHROMIUM:-/Applications/Chromium.app/Contents/MacOS/Chromium}" page="$dir/.header.html" trap 'rm -f "$page"' EXIT cat > "$page" <
HTML render() { "$chromium" --headless --hide-scrollbars --force-device-scale-factor=1 --window-size="$2" \ --screenshot="$dir/$1" "file://$page$3" 2>/dev/null magick "$dir/$1" -alpha off "PNG24:$dir/$1" echo "wrote $dir/$1" } render header-21x9.png 3840,1646 "" render header-16x9.png 5244,2950 "#wide"