Page 1 of 1

Converting/reading RGBA 5551/4444/565 raw data

Posted: 2015-07-06T04:38:16-07:00
by GoodbyeWorld
I'm looking for a way to convert raw RGB(A)5551/4444/565 to raw RGBA8888 data, and vice-versa.
I found the solution for converting RGBA8888 to RGBA5551/4444/565 in this thread:
viewtopic.php?t=19752
But how do I do it the other way round?

Edit: I've managed to solve the problem by using PVRTextToolCLI that comes with the PowerPVR SDK Tool.
Example:
./PVRTexToolCLI -i image_rgb565.pvr -f r8g8b8a8 image_rgba8888.pvr
However, I needed to programmatically append a 52-byte PVR image header to the raw image to make it a .pvr file before passing it in.
And then strip the 52 bytes header + 15 bytes metadata from the top of the output PVR file to get the raw bitmap.
Ugly but it works.