Forum

Convert Images via Python

Started by ScottB, September 26, 2021, 07:58:18 AM

Previous topic - Next topic

ScottB

Quick question,

what is the python command for the equivalent to:

File -> Export -> Convert Images??

Is it exportRater and if so is there an example of this??



Thanks,



Scott.

Paulo

Hi Scott,

I think you look at class ConvertImages in API reference manual p.130...

Best Regards,
Paul Pelletier,
Surveyor

ScottB

Hi,

Again thanks, this works perfectly.

For the sake of others this is the code...


for chunk in doc.chunks:
    for camera in chunk.cameras:
        if camera.enabled:
            newcams.append(camera)

    task = Metashape.Tasks.ConvertImages()
    task.cameras = newcams
    task.path = "C:/myData/myImages/{filename}.jpg"
    task.remove_distortions = True
    task.update_gps_tags = True
    task.fix_principal_point = True
    task.fix_pixel_aspect = True
    task.apply(chunk)




Again thanks for the support, appreciated.


Scott.

Paulo

Hey ScottB,

great to see you got that task spot on!
Best Regards,
Paul Pelletier,
Surveyor