中文 | English
🚀 A powerful, efficient, and customizable SVG avatar generation library for Go
✨ Features • 📦 Installation • 🚀 Quick Start • 🔧 Advanced Usage • 💫 Animation Effects • ⚡ Cache System • 📊 Benchmarks • 💡 Examples and Demos • 👥 Contribution Guide • 📄 License
PixelNebula is a high-performance SVG avatar generation library written in Go, focused on creating beautiful, customizable, and highly animated vector avatars. With PixelNebula, you can easily generate avatars in various styles, add animation effects, and apply different themes and style variations. Whether you're creating user avatars for applications, generating unique identifier icons, or making dynamic visual effects, PixelNebula can meet your needs. |
Various Styles |
Animation Effects |
Customizable |
High Performance |
Cache System |
```go package main import ( "fmt" "os" "github.com/landaiqing/go-pixelnebula" "github.com/landaiqing/go-pixelnebula/style" ) func main() { // Create a new PixelNebula instance pn := pixelnebula.NewPixelNebula() // Set style and size pn.WithStyle(style.GirlStyle) pn.WithSize(231, 231) // Generate SVG and save to file svg, err := pn.Generate("unique-id-123", false).ToSVG() if err != nil { fmt.Printf("Failed to generate SVG: %v\n", err) return } // Save to file err = os.WriteFile("my_avatar.svg", []byte(svg), 0644) if err != nil { fmt.Printf("Failed to save file: %v\n", err) return } fmt.Println("Avatar successfully generated: my_avatar.svg") } ``` |
Operation | Time per Operation | Memory Allocation | Allocations |
---|---|---|---|
Basic Avatar Generation | 3.5 ms/op | 328 KB/op | 52 allocs/op |
No-Environment Avatar | 2.8 ms/op | 256 KB/op | 48 allocs/op |
With Rotation Animation | 4.2 ms/op | 384 KB/op | 62 allocs/op |
Using Cache (Hit) | 0.3 ms/op | 48 KB/op | 12 allocs/op |
Concurrent Generation (10) | 5.7 ms/op | 392 KB/op | 58 allocs/op |
Basic Usage View Code |
Styles & Themes View Code |
Custom Theme View Code |
Animations View Code |
Chain API View Code |
Cache System View Code |
Format Conversion View Code |
Random Avatar Generator View Code |
... |
Fork the Repository |
Create a Branch git checkout -b feature/amazing-feature
|
Commit Changes git commit -m 'Add some feature'
|
Push Branch git push origin feature/amazing-feature
|
Open PR |
Made with ❤️ and Go
© 2025 landaiqing