Upload files to "/"
This commit is contained in:
parent
bb346f645a
commit
4cf51453e8
1 changed files with 46 additions and 0 deletions
46
createicons
Normal file
46
createicons
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Define color variables
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[0;33m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
RESET='\033[0m'
|
||||||
|
|
||||||
|
# Check for the input SVG file argument
|
||||||
|
if [ "$#" -ne 3 ]; then
|
||||||
|
echo -e "${RED}Improper usage!"
|
||||||
|
echo -e "${GREEN}Usage: ${BLUE}$(basename $0) ${YELLOW}input.svg output_filename new_color${RESET}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
input_file="$1"
|
||||||
|
output_filename="$2"
|
||||||
|
new_color="$3"
|
||||||
|
|
||||||
|
# List of output sizes and directory names
|
||||||
|
sizes=(16 22 24 32 48 64 96 128)
|
||||||
|
directories=("16" "22" "24" "32" "48" "64" "96" "128" "scalable")
|
||||||
|
|
||||||
|
# Create directories if they don't exist
|
||||||
|
for dir in "${directories[@]}"; do
|
||||||
|
mkdir -p "$dir"
|
||||||
|
done
|
||||||
|
|
||||||
|
cp "$input_file" "scalable/${output_filename}.svg"
|
||||||
|
echo -e "${GREEN}Copied ${YELLOW}$input_file ${GREEN}to ${YELLOW}./scalable/${output_filename}.svg${RESET}"
|
||||||
|
|
||||||
|
# Generate PNG files for each size
|
||||||
|
for ((i=0; i<${#sizes[@]}; i++)); do
|
||||||
|
size="${sizes[i]}"
|
||||||
|
dir="${directories[i]}"
|
||||||
|
output_file="$dir/${output_filename}.png"
|
||||||
|
|
||||||
|
# Convert the SVG to PNG at the specified size and set the new fill color
|
||||||
|
convert -background none -resize "${size}x${size}" -fuzz 10% -fill "$new_color" -opaque "#000000" "$input_file" "$output_file"
|
||||||
|
|
||||||
|
echo -e "${GREEN}Generated ${YELLOW}$output_file${RESET}"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "${GREEN}PNG files generated.${RESET}"
|
||||||
|
|
Loading…
Reference in a new issue