# image-to-ico **Repository Path**: alexzshl/i2i ## Basic Information - **Project Name**: image-to-ico - **Description**: convert image to ico - **Primary Language**: Go - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-07-07 - **Last Updated**: 2025-07-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🐸 image-to-ico — 将图像转换为ICO格式 [![Language](https://img.shields.io/badge/Language-English-blue?logo=translation)](https://gitee.com/alexzshl/i2i/blob/master/README.md) [![Language](https://img.shields.io/badge/Language-简体中文-white?logo=translation)](https://gitee.com/alexzshl/i2i) [![Go](https://img.shields.io/badge/Go-1.21+-blue?logo=go)](https://golang.org) 一个简单而强大的CLI工具,可将常见图像格式(PNG、JPEG)转换为ICO文件。 > 由Alex于2025年最初构建的个人项目。 --- ## 🔧 功能特性 - ✅ 支持多种输入格式:PNG、JPG - ✅ 支持多尺寸输出(例如:16x16、32x32、...、512x512) - ✅ 支持通配符模式批量处理(`*.png`) - ✅ 可通过标志自定义输出尺寸 - ✅ 跨平台支持:适用于Windows、macOS、Linux - ✅ 使用 [spf13/cobra](https://github.com/spf13/cobra) 进行CLI参数解析 --- ## 🚀 安装方法 ### 通过Go安装 ```bash go install gitee.com/alexzshl/i2i@latest ``` ### 下载二进制文件 预编译的二进制文件可在 [Releases](https://gitee.com/alexzshl/i2i/releases) 页面下载。 --- ## 🧰 使用方法 ### 基础转换 ```bash i2i test.png ``` 它将在同一目录下生成一个 `test.ico` 文件。 ### 生成所有尺寸图标 ```bash i2i -m test.png ``` 它将在同一目录下生成所有尺寸的图标文件。 ### 自定义输出尺寸 ```bash i2i -s 16,32,64 test.png ``` 它将在 `./out/` 目录下生成尺寸为16、32和64的图标文件。 ### 指定输出目录 使用第二个参数指定输出目录。 ```bash i2i test.png dist/ ``` 它将在 `./dist/` 目录下生成图标文件。 ### 帮助菜单 ```bash i2i --help ``` ## 📁 输出结构 如果输入文件多于1个,生成的 `.ico` 文件默认会被放置在 `out/` 目录下,除非另有指定。 示例: ``` out/ ├── test_16.ico ├── test_32.ico ├── test_48.ico └── test_*.ico ``` 🧪 测试方法 要确保你的更改能正常工作: ```bash go test ./... ``` 你也可以运行集成测试: ```bash make test-integration ``` 🏗️ 从源码构建 ```bash git clone https://gitee.com/alexzshl/i2i.git cd i2i go build -o i2i.exe . ``` 📄 开源协议 本项目采用MIT开源协议 – 详见 LICENSE 文件了解详情。