How to capture the Camera image and send it over UDP

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Saul Rodriguez 1

I would like to capture the image of a Camera and send it over UDP
Can I get the image doing this:

var img = get_node("Camera").get_frustum()

Eventually I would like to convert it to PNG, but the raw data works for now.
I have also seen this:

var img = get_viewport().get_texture().get_data()
:bust_in_silhouette: Reply From: toMakeIt