I have a logical problem. How convert image to Byte array or base64 to send via php? I try find some info to turn to base64 and no luck. I think this must made in C++ or can do in Blueprint?
i would like to know too!
me too! Would be nice
Use FBase64::Encode and FBase64::Decode to convert to/from binary <=> base64 text representation.
And how do we retrieve a binary uint8 array from the image?
TArray<FColor> RawData; // <- Assuming this is already populated with the image data
int32 BufferSize = RawData.Num() * 4; // <- Need a data point for each channel of each pixel in RawData
TArray<uint8> DataBuffer;
DataBuffer.Reserve(BufferSize);
for (int32 i = 0, Max = RawData.Num(); i < Max; i++) // <- This loop does the conversion from FColor to uint8
{
DataBuffer.Append({ RawData[i].B, RawData[i].G, RawData[i].R, RawData[i].A });
}
FString encodedString = FBase64::Encode(DataBuffer); // <- Do final encoding to string. Very long running.
Credit belongs to Taking Runtime Screenshots in Unreal Engine | Kazimieras Mikelis' Game Blog as I derived this from that page.
1 Like