Skip to content

HorstBaerbel/GBA-image-tools

Repository files navigation

GBA homebrew image and video conversion tools

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

  • colormap555 - Generate the file colormap555.png that can be used to convert images directly to the GBAs RGB555 color-space with good quality.
  • gimppalette555 - Generate the file GBA.gpl for using / editing / painting with GBA colors in Gimp.
  • hex2gba - Convert a RGB888 color to GBA RGB555 / BGR555 high-color format.
  • img2h - Convert / compress a (list of) image(s) that can be read with ImageMagick 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 RLE or LZ77. Suitable to compress small image sequences too. Documentation is here.
  • vid2h - Convert / compress a 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 RLE, LZ77 or DXT. Documentation is here.

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

License

All of this is under the MIT License. It uses:

Prequisites

  • You must have ImageMagick / Magick++ installed for compiling. Install it with:

    apt install libmagick++-dev or dnf install libmagick++-devel

  • 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

  • For compressing data with LZ77 you need to have devkitPro / devKitARM installed and the environment variable $DEVKITPRO set, or the gbalzss tool in your $PATH.

  • You must have ImageMagick installed for using the "convert" tool for image conversion. Install it with:

    apt install imagemagick or dnf install imagemagick

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.
  • Recommended: If you want intellisense functionality install the "C++ intellisense" extension by austin.
  • 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)

  • TESTS!
  • More modern C++ constructs
  • Do all processing in RGB, store truecolor as BGR in the end
  • Add builtin -remap and +remap option from ImageMagick
  • Clean up and use internal RLE + LZ77 compression