replicant-vendor_replicant/bootanimation/generate-bootanimation.sh
Christopher N. Hesse d2bf7327bb bootanimation: Use mogrify to convert images in place
Fixes bootanimation generation for Darwin/BSD.

Change-Id: Id9e38bcb9db7b550f22bda1250dbb515599e8f93
(cherry picked from commit 70658805a6ddbecd55877fafe4fba8b2efd83f74)
2017-02-10 18:18:03 +00:00

40 lines
945 B
Bash
Executable File

#!/bin/bash
WIDTH="$1"
HEIGHT="$2"
HALF_RES="$3"
OUT="$ANDROID_PRODUCT_OUT/obj/BOOTANIMATION"
if [ "$HEIGHT" -lt "$WIDTH" ]; then
IMAGEWIDTH="$HEIGHT"
else
IMAGEWIDTH="$WIDTH"
fi
IMAGESCALEWIDTH="$IMAGEWIDTH"
IMAGESCALEHEIGHT=$(expr $IMAGESCALEWIDTH / 3)
if [ "$HALF_RES" = "true" ]; then
IMAGEWIDTH=$(expr $IMAGEWIDTH / 2)
fi
IMAGEHEIGHT=$(expr $IMAGEWIDTH / 3)
RESOLUTION=""$IMAGEWIDTH"x"$IMAGEHEIGHT""
for part_cnt in 0 1 2 3 4
do
mkdir -p $ANDROID_PRODUCT_OUT/obj/BOOTANIMATION/bootanimation/part$part_cnt
done
tar xfp "vendor/cm/bootanimation/bootanimation.tar" -C "$OUT/bootanimation/"
mogrify -resize $RESOLUTION -colors 250 "$OUT/bootanimation/"*"/"*".png"
# Create desc.txt
echo "$IMAGESCALEWIDTH $IMAGESCALEHEIGHT" 60 > "$OUT/bootanimation/desc.txt"
cat "vendor/cm/bootanimation/desc.txt" >> "$OUT/bootanimation/desc.txt"
# Create bootanimation.zip
cd "$OUT/bootanimation"
zip -qr0 "$OUT/bootanimation.zip" .