[Python] How can I use a Python script to add a specified file to Metashape chunks?

Discussão em 'Python' iniciado por Stack, Maio 22, 2025.

  1. Stack

    Stack Membro Participativo

    want to automatically add a specified file using a script in Metashape program, but it's not appearing in the chunks. What should I do?

    import Metashape
    import os

    doc = Metashape.Document()
    photo_folder = os.path.expanduser("~/Desktop/dronepics")
    chunk = doc.addChunk()

    for filename in os.listdir(photo_folder):
    if filename.endswith(".jpg") or filename.endswith(".jpeg"):
    photo_path = os.path.join(photo_folder, filename)
    photo = Metashape.Photo()
    photo.open(photo_path)
    chunk.addPhotos([photo])
    doc.save(os.path.expanduser("~/Desktop/çıktı/proje.psx"))


    The code I have written, where did I make a mistake and can you tell me the correct version?

    Continue reading...

Compartilhe esta Página