jim-easterbrook / python-gphoto2

Python interface to libgphoto2
GNU Lesser General Public License v3.0
359 stars 59 forks source link

how to get image quality #89

Closed clementcz closed 4 years ago

clementcz commented 4 years ago

Hi,

Do you know how to get the image quality selected from my camera ?

For example, I would like to know if my camera is selected to take 'raw + jpeg' or only 'jpeg'

I've seen this code but it's not working for me. `error,ImageFormat=gphoto2.gp_widget_get_child_by_name(config,"imageformat") print(ImageFormat.get_value())```

'RAW + Large Fine JPEG' ` https://github.com/jim-easterbrook/python-gphoto2/issues/72

Thank you in advance,

jim-easterbrook commented 4 years ago

This may well be camera dependent. The camera-config-gui.py example will show the names and current values of all the config items your camera has.

clementcz commented 4 years ago

Thank you Jim for your answer. With your file and the code before, I've found it. It was not 'imageformat' but 'imagequality' with my camera (nikon).

Here all code :

        self.camera = gp.check_result(gp.gp_camera_new())
        gp.check_result(gp.gp_camera_init(self.camera))
        self.camera_config = gp.check_result(
            gp.gp_camera_get_config(self.camera))
        OK,  ImageFormat=gp.gp_widget_get_child_by_name(self.camera_config,"imagequality")
        print(ImageFormat.get_value())
jim-easterbrook commented 4 years ago

I've added a note to the relevant example programs in commit febff7b.

pdeman commented 4 years ago

how do you get the list of the possible image format as a python list ? imageFormatMode=gphoto2.check_result(gphoto2.gp_widget_get_child_by_name(self.cameraConfig,"imageformat")) is it possible to have a list of all image format mode possible ? sometimes the camera allows "Raw" format sometimes not. I tried imageFormatMode.get_choices() without success

jim-easterbrook commented 4 years ago

It would help to know how it fails. Not all "widget" types have choices. The camera-config-gui.py example shows how to get the choices from widgets that have them.