99 lines
4.0 KiB
Bash
Executable File
99 lines
4.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# generate-icons.sh - Generate application icons for Kindred Create
|
|
#
|
|
# This script generates icon files for all platforms from the source SVG.
|
|
# Prerequisites:
|
|
# - Inkscape (SVG to PNG conversion)
|
|
# - ImageMagick (ICO generation for Windows)
|
|
# - png2icns or iconutil (ICNS generation for macOS)
|
|
#
|
|
# Usage: ./generate-icons.sh
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
SVG_SOURCE="$SCRIPT_DIR/kindred-logo.svg"
|
|
OUTPUT_DIR="$SCRIPT_DIR/../icons"
|
|
|
|
# Check for source file
|
|
if [ ! -f "$SVG_SOURCE" ]; then
|
|
echo "Error: Source SVG not found at $SVG_SOURCE"
|
|
echo "Please place kindred-logo.svg in the branding directory."
|
|
exit 1
|
|
fi
|
|
|
|
# Check for Inkscape
|
|
if ! command -v inkscape &> /dev/null; then
|
|
echo "Error: Inkscape is required but not installed."
|
|
echo "Install with: sudo apt install inkscape (Debian/Ubuntu)"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Generating icons from $SVG_SOURCE..."
|
|
|
|
# Generate PNGs for Linux/hicolor icon theme
|
|
for size in 16 24 32 48 64 128 256 512; do
|
|
dir="$OUTPUT_DIR/hicolor/${size}x${size}/apps"
|
|
mkdir -p "$dir"
|
|
echo " Generating ${size}x${size} PNG..."
|
|
inkscape -w $size -h $size "$SVG_SOURCE" -o "$dir/kindred-create.png" 2>/dev/null
|
|
done
|
|
|
|
# Copy SVG for scalable
|
|
mkdir -p "$OUTPUT_DIR/hicolor/scalable/apps"
|
|
cp "$SVG_SOURCE" "$OUTPUT_DIR/hicolor/scalable/apps/kindred-create.svg"
|
|
echo " Copied scalable SVG"
|
|
|
|
# Generate Windows ICO (requires ImageMagick)
|
|
if command -v convert &> /dev/null; then
|
|
echo " Generating Windows ICO..."
|
|
convert \
|
|
"$OUTPUT_DIR/hicolor/16x16/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/hicolor/24x24/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/hicolor/32x32/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/hicolor/48x48/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/hicolor/64x64/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/hicolor/128x128/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/hicolor/256x256/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/kindred-create.ico"
|
|
echo " Created kindred-create.ico"
|
|
else
|
|
echo " Warning: ImageMagick not found, skipping ICO generation."
|
|
echo " Install with: sudo apt install imagemagick"
|
|
fi
|
|
|
|
# Generate macOS ICNS (requires png2icns or iconutil)
|
|
if command -v png2icns &> /dev/null; then
|
|
echo " Generating macOS ICNS..."
|
|
png2icns "$OUTPUT_DIR/kindred-create.icns" \
|
|
"$OUTPUT_DIR/hicolor/16x16/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/hicolor/32x32/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/hicolor/128x128/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/hicolor/256x256/apps/kindred-create.png" \
|
|
"$OUTPUT_DIR/hicolor/512x512/apps/kindred-create.png"
|
|
echo " Created kindred-create.icns"
|
|
elif command -v iconutil &> /dev/null; then
|
|
echo " Generating macOS ICNS using iconutil..."
|
|
ICONSET_DIR="$OUTPUT_DIR/kindred-create.iconset"
|
|
mkdir -p "$ICONSET_DIR"
|
|
cp "$OUTPUT_DIR/hicolor/16x16/apps/kindred-create.png" "$ICONSET_DIR/icon_16x16.png"
|
|
cp "$OUTPUT_DIR/hicolor/32x32/apps/kindred-create.png" "$ICONSET_DIR/icon_16x16@2x.png"
|
|
cp "$OUTPUT_DIR/hicolor/32x32/apps/kindred-create.png" "$ICONSET_DIR/icon_32x32.png"
|
|
cp "$OUTPUT_DIR/hicolor/64x64/apps/kindred-create.png" "$ICONSET_DIR/icon_32x32@2x.png"
|
|
cp "$OUTPUT_DIR/hicolor/128x128/apps/kindred-create.png" "$ICONSET_DIR/icon_128x128.png"
|
|
cp "$OUTPUT_DIR/hicolor/256x256/apps/kindred-create.png" "$ICONSET_DIR/icon_128x128@2x.png"
|
|
cp "$OUTPUT_DIR/hicolor/256x256/apps/kindred-create.png" "$ICONSET_DIR/icon_256x256.png"
|
|
cp "$OUTPUT_DIR/hicolor/512x512/apps/kindred-create.png" "$ICONSET_DIR/icon_256x256@2x.png"
|
|
cp "$OUTPUT_DIR/hicolor/512x512/apps/kindred-create.png" "$ICONSET_DIR/icon_512x512.png"
|
|
iconutil -c icns "$ICONSET_DIR" -o "$OUTPUT_DIR/kindred-create.icns"
|
|
rm -rf "$ICONSET_DIR"
|
|
echo " Created kindred-create.icns"
|
|
else
|
|
echo " Warning: Neither png2icns nor iconutil found, skipping ICNS generation."
|
|
echo " Install png2icns with: sudo apt install icnsutils"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Icon generation complete!"
|
|
echo "Output directory: $OUTPUT_DIR"
|