@gitcoder You really shouldn't use ROS for this, especially when network bandwidth is limited. ROS and ROS 2 add significant network bandwidth both local to the device and over the network.

If you really need it over ROS 2, you should use a compressimage sensor message. Here's some code we found through a search https://answers.ros.org/question/385599/how-to-publish-a-compressedimage-in-ros2-foxy/