Converting/reading RGBA 5551/4444/565 raw data

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
GoodbyeWorld
Posts: 1
Joined: 2015-07-06T04:33:26-07:00
Authentication code: 1151

Converting/reading RGBA 5551/4444/565 raw data

Post 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.
Post Reply