Skip to content

Converts animated gif to a single image with it's sprites. Designed to work with the 33x11 led name badge ls32

License

Notifications You must be signed in to change notification settings

mexomagno/gif2sprites

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gif2sprites

Converts animated gif to a single image with it's sprites. Designed to work with the 33x11 led name badge ls32

This project's solely purpose is to produce compatible sprite images for the Led Name Badge L32 project, for 33x11 ls32 screens.

Example

Original gif

Flame

Converted

Flame converted

Installation

  1. Install dependencies (virtualenv is reccomended)
    pip install -r requirements.txt
  2. Run script with python interpreter

Usage

  1. Convert gif to image
    usage: main.py [-h] [--bin-threshold BIN_THRESHOLD] [--invert] [--white-bg]
                 FILE
    
    Convert gif image to a single image with its frames
    
    positional arguments:
    FILE                  Gif file path
    
    optional arguments:
    -h, --help            show this help message and exit
    --bin-threshold BIN_THRESHOLD, -b BIN_THRESHOLD
                          Binarization threshold (black and white conversion)
    --invert, -i          Invert colors
    --white-bg, -w        White background. By default, black is used.
    
  2. Pass image to led name badge script (using the project's instructions)
    python3 ./led-badge-11x44.py -s9 -m5 :flame.png:

Binarization

As the screen doesn't support grayscales, each frame has to be binarized, converting every pixel either to absolute white or absolute black. This process takes into account a threshold gray level from where flip from black to white.

The example was produced with a threshold of 30, as the flames are rather dark, and the background is absolute 0.

TODO

  • Fix: Simulate frames duration (currently they're just equally spaced in time)
  • Minimal GUI
  • Preview generated frames
  • Support for other screen sizes (currently only 33x11 supported)

About

Converts animated gif to a single image with it's sprites. Designed to work with the 33x11 led name badge ls32

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages