sprite-sheet-generator

Combine multiple images into sprite sheets with customizable grid layouts and generate CSS sprite maps for web development.

⭐1stars🔀0forks📁View on GitHub🕐Updated Dec 17, 2025⬇️1downloads

When & Why to Use This Skill

This Claude skill provides an automated solution for generating optimized sprite sheets and CSS maps, essential for modern web performance optimization. By combining multiple images into a single file with customizable layouts, it simplifies asset management, reduces server requests, and enhances website loading speeds through efficient image packing and automated CSS generation.

Use Cases

  • Web Performance Optimization: Consolidate numerous small icons or UI elements into a single image file to minimize HTTP requests and improve Core Web Vitals.
  • Automated Frontend Development: Automatically generate precise CSS classes and background-position coordinates for each sprite, eliminating manual calculations and reducing coding errors.
  • Game Asset Management: Create organized character animation frames or tilemaps for 2D game development with customizable padding and smart packing algorithms.
  • Design System Maintenance: Batch process icon sets into consistent grid arrangements to maintain a clean, scalable, and professional visual asset library for large-scale projects.
namesprite-sheet-generator
descriptionCombine multiple images into sprite sheets with customizable grid layouts and generate CSS sprite maps for web development.

Sprite Sheet Generator

Combine multiple images into optimized sprite sheets with CSS generation.

Features

  • Grid Layouts: Auto or custom grid arrangements
  • Smart Packing: Optimize sprite placement
  • CSS Generation: Auto-generate sprite CSS classes
  • Transparent Backgrounds: Preserve alpha channels
  • Padding/Margins: Control spacing between sprites
  • Batch Processing: Process multiple sprite sets

Quick Start

from sprite_sheet_generator import SpriteSheetGenerator

gen = SpriteSheetGenerator()
gen.add_images_from_dir('icons/')
gen.generate(output='sprites.png', grid=(4, 4))
gen.generate_css('sprites.css', class_prefix='icon')

CLI Usage

python sprite_sheet_generator.py --input icons/ --output sprites.png --grid 4x4 --css sprites.css

Dependencies

  • pillow>=10.0.0