summaryrefslogtreecommitdiff
path: root/icon/svg-import.sh
blob: 6a7ed54c6744af5c230275122a81ae45dbba05fe (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# svg-import.sh - Generate static icon files from SVG
# Run this script manually when you update the SVG icon

set -e

# Check if we're in the icon directory
if [ ! -f "rustyip.svg" ]; then
    echo "❌ Error: rustyip.svg not found in current directory"
    echo "Please run this script from the icon/ directory"
    exit 1
fi

# Check if ImageMagick is installed
MAGICK_CMD=""
if command -v magick &> /dev/null; then
    MAGICK_CMD="magick"
    echo "✅ Found ImageMagick 7+ (magick command)"
elif command -v convert &> /dev/null; then
    MAGICK_CMD="convert"
    echo "✅ Found ImageMagick 6 (convert command)"
else
    echo "❌ Error: ImageMagick not found"
    echo "Please install ImageMagick:"
    echo "  Windows: winget install ImageMagick.ImageMagick"
    echo "  macOS:   brew install imagemagick"
    echo "  Ubuntu:  sudo apt install imagemagick"
    exit 1
fi

echo "🎨 Generating icon files from rustyip.svg..."

# Generate Windows ICO file with multiple resolutions
echo "📦 Creating rustyip.ico (multi-resolution)..."
$MAGICK_CMD rustyip.svg \
    -background none \
    -fill none \
    -fuzz 0% \
    -transparent white \
    -filter point \
    -interpolate nearest \
    -define icon:auto-resize="256,128,64,48,32,24,20,16" \
    rustyip.ico

# Generate PNG
echo "📄 Creating rustyip.png (256x256)..."
$MAGICK_CMD rustyip.svg \
    -background none \
    -fill none \
    -fuzz 0% \
    -transparent white \
    -filter point \
    -interpolate nearest \
    -resize 256x256 \
    PNG32:rustyip.png

echo ""
echo "✅ Icon generation complete!"
echo ""
echo "📋 Generated files:"
ls -la *.ico *.png 2>/dev/null || echo "No files found"