Is the picture binary format documented somewhere?
I have a image representation in another programming language that follows a simple format, and would like to convert that to a MemoryBlock so that I can convert it to a Xojo picture.
The binary format of a picture in that other programming language is:
The first 4 bytes of the memlbock store the image width, the next 4 bytes store the image height, the next 4 bytes store the bit depth, currently this will always be 32. After that the raw image data begins in the format RGBA, with each component stored in a single byte, so each pixel takes up 4 bytes.
So, very easy, but I can’t seem to find any info on the Xojo Picture class. I read this page:
Picture.FromData and the Picture class documentation. But I cannot find the binary format.
Am I missing something obvious?
Thanks a bunch for insights!!
Xojo supports a few standard picture formats.
Picture.FromData is likely only able to handle picture data generated by
Picture.GetData, there isn’t much more in the documentation to suggest otherwise.
If your other tool supports standard formats like JPEG or PNG, I would use those.
However, if not, it looks like you have enough information to reconstruct the image using RGB surface.
Thanks a bunch Tim, you have no idea how much you’ve helped me with just saying “RGBsuface”. This is exactly what I need.
To go over your post:
I know, I just wanted to know if I also could assemble the information in such a way that FromData could handle it.
Indeed, I would too. But this is no option.
This is good. I can create a picture with the right height and width, and iterate over all pixels to set the right RGBA values.
Picture.FromData can read whatever formats Picture.Open can read.
This varies by platform (see
If you mean Mac Pict format there is some info in bottom links here:
I think, this contains the info was looking for: