hello iliesaya,
please refer to L4T Accelerated GStreamer User Guide,
you might modify the gstreamer pipeline to include image encoder and dump it as jpg file.
for example,
$ gst-launch-1.0 nvarguscamerasrc num-buffers=1 ! 'video/x-raw(memory:NVMM), width=2592, height=1944' ! nvjpegenc ! filesink location=sample.jpg
please note that, you should enable different plugins for MIPI and USB sensors.
please check Camera Architecture Stack, that you should only enable v4l2src to access USB cameras.
thanks