forked from aessam/MyScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathandroidAssetFixer
More file actions
executable file
·48 lines (39 loc) · 801 Bytes
/
Copy pathandroidAssetFixer
File metadata and controls
executable file
·48 lines (39 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
sizesNames=( "drawable-xhdpi" "drawable-hdpi" "drawable-mdpi" )
sizesValues=( 66% 50% 33% )
# Create Folder if not exist
function cin {
if ! [ -e $1 ]; then
mkdir $1
fi
}
# Create assest folders
function cds {
for item in $(seq 0 $((${#sizesNames[@]} - 1)))
do cin ${sizesNames[$item]}
done
cin "drawable-xxhdpi"
}
function fixImage {
if [ -n "$1" ]; then
echo " Processing asset "$1" ..."
if [ -e $1 ]; then
for item in $(seq 0 $((${#sizesNames[@]} - 1)))
do
convert $1 -resize ${sizesValues[$item]} ${sizesNames[$item]}/$1
done
mv $1 drawable-xxhdpi/$1
else
echo "Can't find file."
fi
else
echo "Please set the xxhdpi file name."
fi
}
# Creating folders
cds
# Loop through the images and fix it for each size
for f in *.png
do
fixImage $f
done