Forum

Author Topic: Importing images from list in a text file  (Read 1650 times)

mwillis

  • Full Member
  • ***
  • Posts: 140
    • View Profile
Importing images from list in a text file
« on: January 08, 2019, 06:30:47 AM »
Hi, I am hoping someone can point me in the right direction.  I have a text file with a large number of photos that I would like to add to a new project.  The images are scattered across several partitions and for reasons that are complicated, I need to leave the images in their current directors.

Is there a way to automatically add files from a text file with the following syntax?

I:\Projects\Marsoulas\D31-D42.5\Wall_Base_Gilles\D37-39_Mos releve 2018Willis.jpg
I:\Projects\Marsoulas\D31-D42.5\Wall_Base_Gilles\D37_38_Connector releve 2018Willis.jpg
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8246.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8003.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8004.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8005.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8006.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8007.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8008.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8009.JPG
... files continue for hundreds of lines

Thanks for any help you can share.

Mark

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14846
    • View Profile
Re: Importing images from list in a text file
« Reply #1 on: January 08, 2019, 09:08:42 PM »
Hello Mark,

You can do it with the Python script:

Code: [Select]
import PhotoScan
path = PhotoScan.app.getOpenFileName("Specify the location of the text file with the paths:")
file = open(path, "rt")
lines = file.readlines()
lines = [line.strip() for line in lines]
chunk = PhotoScan.app.document.addChunk()
chunk.addPhotos(lines)
file.close()
Best regards,
Alexey Pasumansky,
Agisoft LLC

mwillis

  • Full Member
  • ***
  • Posts: 140
    • View Profile
Re: Importing images from list in a text file
« Reply #2 on: January 20, 2019, 04:24:46 PM »
Thank you, sir!