When using Capture.Image images are stored in the same folder as the python script.


  • How could I change the path of where the images are stored and give each image a specific name? I have tried to look at all the scripts in the library to see where it outputs but I am probably missing something.



  • Hi Jose,
    The Capture.Image call in the API sends a request to the scanner, which sends back a response that has the image wrapped. You can see the capture Image example here.
    In that example, the image will be saved to where the code is running.
    If you want to change the destination, then you can use the example and change this line here.

    Heres an example of changing the buffer response to save the image in the downloads folder:

      def OnBuffer(descriptor, buffer:bytes):
            # Video task
            if descriptor.Task['Type'] == 'CaptureImage': 
                imageDescriptor = CaptureImageDescriptor(**descriptor.Descriptor)
    
                # Save to the user's Downloads folder on Windows (or other OS)
                downloads = Path.home() / "Downloads"
                downloads.mkdir(parents=True, exist_ok=True)
                out_path = downloads / f'camera{imageDescriptor.camera}_image.{imageDescriptor.codec}'
    
                with open(out_path, 'wb') as f:
                    f.write(buffer)

Please login to reply this topic!