From 16afd702946d3f3fecf085d17f5397f5b957ec06 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Wed, 9 Mar 2022 09:23:26 +0100 Subject: [PATCH] tmp_icon.sh: Script to quickly try out new launcher icons People suggest new icons in png formats, and I'm tired of searching this scripts, so let's push it to main Change-Id: Ie3cb2f7f82383c60188ae8499ad64b61264435d8 --- graphics/tmp_icon.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 graphics/tmp_icon.sh diff --git a/graphics/tmp_icon.sh b/graphics/tmp_icon.sh new file mode 100755 index 0000000000..1159f981c3 --- /dev/null +++ b/graphics/tmp_icon.sh @@ -0,0 +1,35 @@ +#!/usr/bin/zsh +# Using zsh allows floating point multiplication in $((...)) + +mydir="$(dirname "$(realpath "$0")")" + +base_folder="$mydir/../vector-app/src/main/res/mipmap" + +file="$1" + +export_png_files() { + newfile="$1" + mdpi_w="$2" + mdpi_h="$3" + if [ -z "$mdpi_h" ]; then + mdpi_h="$mdpi_w" + fi + mkdir -p $base_folder-mdpi + mkdir -p $base_folder-hdpi + mkdir -p $base_folder-xhdpi + mkdir -p $base_folder-xxhdpi + mkdir -p $base_folder-xxxhdpi + convert "$file" -resize "${mdpi_w}x${mdpi_h}" "$base_folder-mdpi/$newfile" + convert "$file" -resize "${$((mdpi_w*1.5))%.*}x${$((mdpi_h*1.5))%.*}" "$base_folder-hdpi/$newfile" + convert "$file" -resize "${$((mdpi_w*2))%.*}x${$((mdpi_h*2))%.*}" "$base_folder-xhdpi/$newfile" + convert "$file" -resize "${$((mdpi_w*3))%.*}x${$((mdpi_h*3))%.*}" "$base_folder-xxhdpi/$newfile" + convert "$file" -resize "${$((mdpi_w*4))%.*}x${$((mdpi_h*4))%.*}" "$base_folder-xxxhdpi/$newfile" +} + +export_png_files "ic_launcher_sc.png" 48 + +file2="fg_$file" +convert "$file" -gravity center -background none -extent 150%x150% "$file2" +file="$file2" +export_png_files "ic_launcher_foreground_sc.png" 72 +rm "$file2"