1
Python and Java API / Re: add photo and save project
« on: August 26, 2015, 03:21:21 PM »
Hello Alexey,
Thanks your hint, the problem was little strange for me:
if I use this:
The program don't add tif photos.
But if I use this line:
The program add tif files for chunk.
But Now the program works fine
and Really thanks your and James help .
here is the complet code:
Regards
Peter
Thanks your hint, the problem was little strange for me:
if I use this:
Code: [Select]
if ("tiff" or "tif") in photo.lower():
The program don't add tif photos.
But if I use this line:
Code: [Select]
if ("tif" or "tiff") in photo.lower():
The program add tif files for chunk.
But Now the program works fine
and Really thanks your and James help .
here is the complet code:
Code: [Select]
import os
import PhotoScan
global doc
doc = PhotoScan.app.document
#path to photos
path_photos = PhotoScan.app.getExistingDirectory("Specify input photo folder:")
print("Script started")
#creating new chunk
doc.addChunk()
chunk = doc.chunks[-1]
chunk.label = "New Chunk"
project_path = PhotoScan.app.getSaveFileName("Specify project filename for saving:")
if not project_path:
print("Script aborted")
if project_path[-4:].lower() != ".psz":
project_path += ".psz"
#loading images
image_list = os.listdir(path_photos)
photo_list = list()
for photo in image_list:
if ("tif" or "tiff") in photo.lower():
photo_list.append(path_photos + "\\" + photo)
chunk.addPhotos(photo_list)
doc.save(project_path)
PhotoScan.app.update()
print("Script finished")
Regards
Peter