4 bpp sprite converter app


Established Member
Here is an image converter windows app (for TGA files only) that will convert the images to both c source code and binary file in a 4 bits per pixel format. The app is super simple to use : put it in your image folder, launch it and just type de filename without the extension. It will convert and produce 2 files (filename.h and filename.bin).

I've also included a demo to use it both for 16 Colors Lookup Table sprites (VDP1) and 16 Colors Bank (VDP2 Color RAM) using Jo Engine (but you can also easily use it with SGL only with few modifications). The demo loads one sprite from c code and two from binary files. It displays one sprite using VDP2 CRAM and two using CLUT. It's using JO Engine in a ghetto fashion as 4 bpp isn't supported, so let me know if it creates issues for you.

Using 4 bits per pixel sprites helps reducing the VRAM usage while also easily allowing you to use advanced VDP2 effects.

I did it quickly and didn't do much testing, so let me know if it doesn't work well!

EDIT : I updated the app. It will now compress the color data if the image contains more than 16 colors, but the result won't be optimal since it just removes the LSB until the image fits. I've included a sprite showing the results (the Sonic sprite, which contained way more than 16 colors).

EDIT 2 : Updated to add a 4 bytes buffer area to set the pointer. Should fix some small glitches.


  • demo - 4 Bits CLUT 0.25.zip
    376.5 KB · Views: 259
Last edited:
  • Like
Reactions: vbt
great job XL2, another advantage is you don't use the CRAM to get more colors on the screen.
I used that trick on sega system 1 emulation.
  • Like
Reactions: XL2
I did a small update : I fixed a bug with the sprite's orientation and also added auto-compression of the palette data if the image contains more than 16 colors (it's just removing the LSB until it fits, so the results aren't ideal).