Atlas Robotics
CameraIntermediate

image_transport in ROS2: sending images efficiently between nodes

Atlasbot · 18/8/2026 · 11 min read

image_transport in ROS2: sending images efficiently between nodes
image_transport supports multiple transparent image compression plugins with subscriber nodes

A 640×480 uncompressed (raw) camera frame weighing nearly 1 MB — that publishes a continuous 30 frames per second over the usual ROS2 topic can take up significant bandwidth, especially when transmitted over the network between multiple computers in the same AMR. The package image_transport solves this problem.

Key concepts

If publication of images using sensor_msgs/Image over normal ROS2 topics (rclpy.Publisher), the data are always in raw — with each frame sent uncompressed, no matter how many subscribers listen. With robots running multiple nodes on multiple different computers (e.g. 1 camera processor, 1 machine running the — surveillance interface in the same ROS2 Layer architecture as learned at the ROS2 Layer in AMR), internal network bandwidth quickly becomes the bottleneck.

How it works

image_transport offers a class of API similar to conventional publisher/subscriber, but allows selecting different plugin transmit — The most common are raw (uncompressed, conventional publish-like), compressed (JPEG/PNG compressed), and theora (video compressed, optimized for continuous image flow).

The good point is that the subscriber does not need to know which plugin the publisher is using—image_transport to negotiate the format itself, unpack transparent before returning the image to user code.

# Publisher (C++ is usually used for speed, but the idea is similar to Python)
image_transport::ImageTransport it(node);
image_transport::Publisher pub = it.advertise("camera/image", 1);
pub.publish(cv_bridge::CvImage(header, "bgr8", frame).toImageMsg());
# View image topics + compressed variants image transport creates
ros2 topic list | grep image
# camera/image
# camera/image/compressed
# camera/image/compressedDepth (if depth camera exists)

Technical details

Formulas

Typical JPEG compression ratios help estimate the bandwidth benefits of switching from raw to compressed:

Raw size ≈ Width × Height × 3 bytes (RGB)
Compressed size ≈ Raw / ratio JPEG compression

VD: 640×480 RGB raw ≈ 640×480×3 ≈ 921,600 byte ≈ 900KB
Medium quality JPEG typically compresses 10-20 times
Compressed size ≈ 900KB / 15≈ 60KB

bandwidth raw (30fps) ≈ 900KB × 30 ≈ 27MB/s
bandwidth compressed (30fps) ≈ 60KB × 30 ≈ 1.8MB/s

Parameters

PluginbandwidthCPU cost (compression/uncompression)Used when
rawHighestNoneCamera and node working on the same machine
compressedLow (JPEG/PNG)MediumNetwork to another host
theoraLow, optimal for continuous videoHigher than compressedLong video stream, preferring compression over still images

Practical applications

If the camera and image-processing node (OpenCV, YOLO...) run on the same computer, using raw is simplest — with no extra compression/uncompression costs. Simply switching to compressed when images have to be transmitted over the network to another machine, e.g. sending a robot camera image back to the remote PC monitoring interface — as calculated in the Formulary, saves 10 times more bandwidth while the CPU compression/uncompression cost is usually negligible compared to that benefit.

Practical example

# Comparison of raw and compressed real-world bandwidth
ros2 topic hz /camera/image                  # frequency publish raw
ros2 topic bw /camera/image                  # bandwidth real-world raw

ros2 topic hz /camera/image/compressed
ros2 topic bw /camera/image/compressed       # compressed real-world bandwidth
Typical results (camera 640x480 @ 30fps):
/camera/image            -> ~27 MB/s (raw)
/camera/image/compressed -> ~1.8 MB/s (JPEG compressed)

On an internal WiFi network (practical bandwidth typically 10-50 MB/s depending on conditions),
raw images can consume almost all available bandwidth, affecting other topics
(such as /scan, /odom) on the same network — compressed transport addresses this problem

Common mistakes

  • Using raw when an image needs to be transmitted over the network to another host — as an example above, consumes unnecessarily large bandwidth, which can affect other important topics (odometry, scanning) sharing the same network.
  • Use compressed when the camera and node process together— paying unnecessary CPU compression/uncompression costs when there is no commensurate bandwidth benefit (not going through the network).
  • No real-world bandwidth checks by ros2 topic bw— only estimates theory without confirming real-world, easily missing other factors (procedural overheads, multiple subscribers at once).
  • If the subscriber automatically understands every plugin without compatibility checks— even though image_transport negotiates the transparent format, it is necessary to ensure that both the publisher and the subscriber install the correct necessary plugin (e.g., compressed_image_transport).

Conclusion

image_transport separates "send images" from "compression of images" — which makes it possible to switch between raw and compressed formats without having to correct the image processing code on the subscriber side. Select the correct plugin according to whether or not the image goes through the network, based on the significant bandwidth difference between raw and compressed as mentioned above. The next article in the column goes into Camera Calibration — the preparation step needed when the application needs to measure the correct distance/size from the image.

Get new articles and lessons by email

When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.

Unsubscribe any time with the link in each email. See our Privacy policy.

image_transport in ROS2: sending images efficiently between nodes — Atlas Robotics