Converting an image to a specific byte format

185 views Asked by At

So, I'm using an API to display a picture and it requires me to insert the actual bytes from the picture and not any specific file. There are a few listed examples, where they display pictures through hex bytes in a C vector, and the format they have is as follows:

If the picture has x width and y height and is mono color, the amount of bytes is exactly x times y. If the picture is RGB, the amount of bytes is exactly x times y times 3 (which I assume is one byte for R, one for G, one for B).

I'm trying to display an arrow which I've tried to convert to BMP and RAW, but I know very little about image formatting and it obviously didn't work, as those files always ended up with way too many bytes. Is there some sort of converter that I can hopefully make or find to convert a picture into that hex C vector, or am I over complicating all of this?

Thanks, José Almeida

0

There are 0 answers