Skip to content

Latest commit

 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svg2icon

A fast and lightweight command-line tool for converting SVG files to platform-specific icon formats. Generates high-quality ICO files for Windows and ICNS files for macOS from SVG sources.

Features

  • Cross-platform support: Windows, macOS, and Linux
  • Multiple output formats: ICO (Windows) and ICNS (macOS)
  • High-quality rendering: Vector-based conversion with anti-aliasing
  • Multiple resolutions: Generates all standard icon sizes automatically
  • Retina support: Includes high-DPI variants for modern displays
  • Simple interface: Single command with flexible output options
  • No dependencies: Standalone binary with no external requirements

Installation

Quick Install

Unix/Linux/macOS:

curl -sSL https://raw.githubusercontent.com/julian-bruyers/svg2icon/main/scripts/install.sh | bash

Windows PowerShell:

iwr -useb https://raw.githubusercontent.com/julian-bruyers/svg2icon/main/scripts/install.ps1 | iex

Manual Installation

  1. Download the appropriate binary from the releases page
  2. Rename it to svg2icon (or svg2icon.exe on Windows)
  3. Place it in your PATH

Build from Source

Prerequisites:

  • Go 1.21 or later

Clone and build:

git clone https://github.com/julian-bruyers/svg2icon.git
cd svg2icon
go build -o svg2icon .

Unix/Linux/macOS

./scripts/build.sh

Windows

scripts\build.bat

Usage

Basic Syntax

svg2icon <input.svg> <output>

Generate ICO file only:

svg2icon input.svg output.ico

Generate ICNS file only:

svg2icon input.svg output.icns

Generate both formats in directory:

svg2icon input.svg ./icons/
# Creates: icons/input.ico and icons/input.icns

Generate both formats with custom name:

svg2icon input.svg myicon.icon
# Creates: myicon.ico and myicon.icns

Examples

# Convert app icon for Windows
svg2icon app-icon.svg app.ico

# Convert app icon for macOS
svg2icon app-icon.svg app.icns

# Generate both formats
svg2icon app-icon.svg ./build/icons/

# Convert with custom naming
svg2icon logo.svg brand.icon

Icon Specifications

ICO Format (Windows)

  • Sizes: 16x16, 24x24, 32x32, 48x48, 64x64, 128x128, 256x256
  • Format: PNG-encoded images within ICO container
  • Color depth: 32-bit RGBA

ICNS Format (macOS)

  • Standard sizes: 16x16, 32x32, 64x64, 128x128, 256x256, 512x512, 1024x1024
  • Retina variants: 32x32 (16x16@2x), 64x64 (32x32@2x), 256x256 (128x128@2x), 512x512 (256x256@2x)
  • Format: PNG-encoded images with Apple OSType identifiers
  • Color depth: 32-bit RGBA

Development Scripts

Build for all platforms:

./scripts/build.sh        # Creates binaries in ./build/
scripts\build.bat         # Windows equivalent

Install locally:

./scripts/install.sh      # Unix/Linux/macOS
scripts\install.ps1       # Windows

Uninstall:

./scripts/uninstall.sh    # Unix/Linux/macOS
scripts\uninstall.bat     # Windows

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • resvg - Rust SVG rendering engine with full SVG 2.0 support
  • wazero - Go WebAssembly runtime
  • resvg-go - Go WebAssembly wrapper for resvg via wazero

About

CLI tool that generates ico/icns application icons from vector graphics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages