Cheese: How to save camera image with another format (other than .jpg)?

cheese apparently can't do this in the current version.

The source code looks as if the file extension '.jpg' is hard-coded.

So if you want to change that, you could start with an issue at https://gitlab.gnome.org/GNOME/cheese/-/issues. And if you know C, then you could even provide a merge request there.

However, there are other programs that take snapshots in lossless formats and can be used from the command line interface, e.g. gucview:

guvcview -i my_image1.png -g none -e -t 1 -n 1

This creates a single snapshot (see guvcview --help for details).

According to another stackoverflow thread, vlc can also be used from the command line:

vlc -I dummy v4l2:///dev/video0 --video-filter scene --no-audio --scene-path /tmp --scene-prefix image_prefix --scene-format png vlc://quit --run-time=1

seems to save many snapshots until you abort the process with ctrl-c. (The last two params seem to be ignored in my system.)