Send Image With PersistentKeyValue

Hello,

I want to send and receive image through the lighship network with the PersistentKeyValue scene template.
For the moment i succeeded to send and receive an int with Int16Serializer.Instance.Serialize(binarySerializer, 0).

In the folder Assets\ARDK\Utilities\BinarySerialization\ItemSerializers is there something i could use to send my images ? Is it possible to convert my images in bytes and use ByteArraySerializer or ByteSerializer (which is the best for images?) ?

Thank you

Hello Hakim,

We do not have a class that serializes an image directly. However, we do have a ByteArraySerializer.

You can attempt to convert an image into a byte array and then serialize the data using ByteArraySerializer. When it gets to the other end, you can try to deserialize.

Unity has EncodeToPNG which can be used as a byte stream but it assumes the image being encoded is a Texture2D. You can also take a look at this Unity Forums post I found: https://answers.unity.com/questions/1436530/how-do-i-convert-a-png-to-a-byte-array-then-from-b.html

@Jesus_Hernandez thank you so much,