-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerateIcons.sh
executable file
·47 lines (40 loc) · 1.35 KB
/
generateIcons.sh
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
#!/bin/bash
# Check if icons installed
directory="./node_modules/cryptocurrency-icons"
if [ ! -d "$directory" ]; then
echo "Directory $directory does not exist, please run 'yarn install' first"
exit 1
fi
# Check if imagemagick installed
if ! command -v convert &> /dev/null; then
echo "imagemagick could not be found, please install it first"
exit
fi
# If coinIcons directory exists, remove it
if [ -d "./assets/coinIcons" ]; then
echo "Removing old coinIcons directory"
rm -rf coinIcons
fi
# Copy images from node_packages to assets
echo "Copying images from node_modules to assets"
cp -R node_modules/cryptocurrency-icons/32/white assets/32
cp -R node_modules/cryptocurrency-icons/32@2x/white assets/32@2x
echo "Done copying images"
echo "Handling images"
# Resize images in 32 directory and move to new directory
mkdir -p assets/coinIcons
for file in assets/32/*.png; do
filename=$(basename "$file")
convert "$file" -resize 16x16 "assets/coinIcons/${filename/./Template.}"
done
# Resize images in 32@2x directory and move to new directory
for file in assets/32@2x/*.png; do
filename=$(basename "$file" .png)
convert "$file" -resize 32x32 "assets/coinIcons/${filename/./Template.}@2x.png"
done
echo "Done handling images"
# Remove temp directories
echo "Removing temp directories"
rm -r assets/32
rm -r assets/32@2x
echo "Done!"