This project demonstrates how to serialize/deserialize a byte array in C# - Python and viceversa. The primary use case is to work with images. The project contains these files:
Program.cs: A C# console project that creates a byte array of a specified image size, serializes it, and saves it to a file. It also includes a timestamp to measure the execution time.
deserialize.py: A Python script that reads the byte array from the file created by the C# project, deserializes it, and converts it to a numpy array. It also includes a timestamp to measure the execution time.
serialize.py: A Python script that create a numpy array that containts center of a rectangle and widht and height and serialize numpy array to byte array.
- Make sure you have C# and Python installed on your machine.
- Clone or download the project.
- Open the project in Visual Studio and run the C# code to generate the byte array and serialize it.
- Run the Python script to read it.
- Run the C# code to generate the byte array and serialize it.
- Run the Python script to read it. Note: You can disable print results by setting 'print_results' variable as False.
- C#
- Python
In C#:
- using System;
- using System.Linq;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.IO;
In Python:
- numpy
- time
This project is licensed under the MIT License.
Sergio Redondo: https://github.com/rodo1985
- Serialization of byte arrays in C#
- Deserialization of byte arrays in Python
- Timestamp for measuring execution time
- Option to disable print results
- Add more data types for serialization and deserialization
- Add support for more file formats
- Optimize the execution time
- csharp byte array serialization
- python byte array deserialization
- csharp python byte array communication
- csharp image serialization
- python image deserialization