spritepacker

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2025 License: MIT

README


🧩 SpritePacker | 精灵图打包工具

SpritePacker is a 2D sprite sheet packing tool, designed for game developers


📦 Installation | 安装

go get -u github.com/91xusir/spritepacker

or

git clone https://github.com/91xusir/spritepacker.git
cd spritepacker
go build .

🛠 Usage | 使用方式

CLI 命令行

Options 参数说明
Flag Description (EN) 描述(中文)
-input Input image folder 输入图片文件夹
-output Output atlas & metadata directory 输出图集和元数据目录
-maxw Maximum atlas width 最大图集宽度
-maxh Maximum atlas height 最大图集高度
-trim Trim transparent edges 裁剪透明边缘
-rotate Allow 90-degree rotation 允许旋转优化
-autosize Auto resize the canvas 自动调整尺寸
-format Output format (json, xml, etc.) 输出格式(json、xml 等)

📂 Output Example | 输出示例

├── atlas.png        # Packed texture 图集
├── atlas.json       # Metadata 元数据(包含坐标、尺寸等)

🧠 Algorithm | 算法

  • Basic
  • MaxRects
  • Skyline

🧪 Go API Example | Go 语言调用示例


Directories

Path Synopsis
Package main provides a command-line tool for sprite atlas packing and unpacking.
Package main provides a command-line tool for sprite atlas packing and unpacking.
Package pack provides texture packing utilities, including support for rotation, transparent pixel trimming, automatic resizing and so on.
Package pack provides texture packing utilities, including support for rotation, transparent pixel trimming, automatic resizing and so on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL