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
This commit is contained in:
parent
76d1c81495
commit
16afd70294
|
@ -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"
|
Loading…
Reference in New Issue