I am currently having the following problem: I want to convert a byte array that comes from a file with the following configuration:
Byte1: R color of pixel 0,0.
Byte2: G color of pixel 0,0.
Byte3: B color of pixel 0,0.
Byte4: R color of pixel 0,1.
...
ByteN: R color of pixel n,n.
So what I want to do is convert these bytes into a bitmap without having to set pixel by pixel with bitmap.setPixel because it takes too long.
Any suggestions? Thanks in advance!
If you have the
byte[]of the pixels, and the width and height, then you can useBitmapDatato write the bytes to the bitmap since you also know the format. Here’s an example:This is a very fast operation.
You will need to import these three namespaces at the top of your C# file, at minimum: