Skip to content

HorstBaerbel/GBA-image-tools

Repository files navigation

GBA homebrew image and video conversion tools

License: MIT Build

This folder contains some tools to convert / compress images and videos to GBA formats for homebrew development:

  • gencolormaps - Generate the files colormap555.png and colormap565.png that can be used to convert images directly to the GBA RGB555 and NDS RGB565 color space with good quality.
  • hex2gba - Convert a RGB888 color value to RGB555, RGB565 and BGR555, BGR565 high-color format for GBA / NDS .
  • img2h - Convert / compress a (list of) image(s) that can be read with libplum to a .h / .c file to compile them into your program. Can convert images to a tile- or sprite-compatible format ("1D mapping" order) and compress them with LZ77 or LZ4. Suitable to compress small image sequences too. Documentation is here.
  • vid2h - Convert / compress a video that can be read with FFmpeg to a .h / .c file to compile them into your program. Can convert images to a tile- or sprite-compatible format ("1D mapping" order) and compresses them using intra- and inter-frame techniques and LZ77, Lz4 or DXT. Documentation is here.
  • vid2play - Play vid2h-compressed files.

If you find a bug or make an improvement your pull requests are appreciated.

License

All of my work is under the MIT License. It uses:

Prerequisites

  • You must have OpenMP installed for compiling. Install it with:

    apt install libomp-dev or dnf install libomp-devel

  • You must have FFmpeg installed for compiling vid2h. Install it with:

    apt install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev or dnf install libavcodec-devel libavformat-devel libavutil-devel libswscale-devel

  • You must have SDL3 v3.2.0 or higher installed for compiling vid2h / vid2hplay. Install it with:

    apt install libsdl3-dev or dnf install SDL3-devel

Building

From the command line

Navigate to the GBA-image-tools folder, then:

mkdir build && cd build
cmake ..
make

To build a release package, call:

make package

From Visual Studio Code

  • Must: Install the "C/C++ extension" by Microsoft.
  • Must: Install the "CMake Tools" extension by Microsoft.
  • You might need to restart / reload Visual Studio Code if you have installed extensions.
  • Open the GBA-image-tools folder using "Open folder...".
  • Choose a kit of your choice as your active CMake kit if asked.
  • You should be able to build now using F7 and build + run using F5.

Todo (general)

  • More TESTS!
  • More modern C++ constructs
  • Clean up and use internal RLE + Huffman compression
  • Improve documentation