Forum

Author Topic: Change path/replace photos  (Read 19052 times)

bmc130

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Change path/replace photos
« on: March 17, 2014, 12:28:43 PM »
Hi all! How do I change a chunk of 57 photos in jpg format to the same photos but in tiff? I right click the picture, choose change path select my first picture and choose replace active chunk but from there nothing happens it only replaces my first picture to the tiff version the rest are unchanged and still in jpg format. All photos are named the same except for the .tif from .jpg.

Do I need to replace all pictures by hand or how is it suppose to work?


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15029
    • View Profile
Re: Change path/replace photos
« Reply #1 on: March 17, 2014, 01:03:41 PM »
Hello bmc130,

According to its' name, the feature only changes the path to the images (for example, if the image set has been moved to another folder) and is not able to change the extension of the images used for the project.
To do that you can use Python script, something like the following:
Code: [Select]
chunk = PhotoScan.app.document.activeChunk
for i in range (len(chunk.cameras)):
    chunk.cameras[i].frames[0].path = chunk.cameras[i].path.replace(".jpg", ".tiff")
Best regards,
Alexey Pasumansky,
Agisoft LLC

bmc130

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: Change path/replace photos
« Reply #2 on: March 17, 2014, 01:16:27 PM »
Hi Alexey, thanks for the answer. I dont know anything about python or how to use it inside of photoscan. I have the standard version is python working in that one?

Just a workflow question. Is there any difference in doing a scan with 8bits jpgs compared to 16bit tiffs? Any difference in speed, quality and so on. For some reason I usually do my scans with 8bit jpgs cause I thought they were quicker to process and then later change the photos to 16bit when generating my texture to have a better bit quality to them?

What I would like to have in the end for my texture is actually an exr version although my camera raw (canon) is only 16bit I assume.

Any guides on which way to go and proceed would be awesome:)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15029
    • View Profile
Re: Change path/replace photos
« Reply #3 on: March 17, 2014, 01:25:57 PM »
There will not be any processing time difference for jpgs and tiffs of the same resolution except the time spent on Loading Photos sub-step of the processing stage.
Best regards,
Alexey Pasumansky,
Agisoft LLC

bisenberger

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Digital Mapping & Graphics
Re: Change path/replace photos
« Reply #4 on: January 11, 2017, 01:41:34 AM »
Hello bmc130,

According to its' name, the feature only changes the path to the images (for example, if the image set has been moved to another folder) and is not able to change the extension of the images used for the project.
To do that you can use Python script, something like the following:
Code: [Select]
chunk = PhotoScan.app.document.activeChunk
for i in range (len(chunk.cameras)):
    chunk.cameras[i].frames[0].path = chunk.cameras[i].path.replace(".jpg", ".tiff")
This looks useful, will try it out.
Thanks,
Alexey
Digital Mapping & Graphics LLC
https://digital-mapping.net/

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15029
    • View Profile
Re: Change path/replace photos
« Reply #5 on: January 11, 2017, 07:09:13 AM »
Hello bisenberger,

for the version 1.2/1.3 the active chunk should be selected as chunk = PhotoScan.app.document.chunk.
Best regards,
Alexey Pasumansky,
Agisoft LLC

bisenberger

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Digital Mapping & Graphics
Re: Change path/replace photos
« Reply #6 on: January 12, 2017, 06:49:28 AM »
Hi Alexey,
Can't get it to work.

Is this correct?

chunk = PhotoScan.app.document.chunk
for i in range (len(chunk.cameras)):
    chunk.cameras.frames[0].path = chunk.cameras.path.replace(".jpg", ".tiff")

I have a project open and a chunk selected. Are there other requirements?


Digital Mapping & Graphics LLC
https://digital-mapping.net/

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15029
    • View Profile
Re: Change path/replace photos
« Reply #7 on: January 12, 2017, 09:45:58 AM »
Hello bisenberger,

The rest should be the same:
Code: [Select]
for i in range (len(chunk.cameras)):
    chunk.cameras[i].frames[0].path = chunk.cameras[i].path.replace(".jpg", ".tiff")
Best regards,
Alexey Pasumansky,
Agisoft LLC

bisenberger

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Digital Mapping & Graphics
Re: Change path/replace photos
« Reply #8 on: January 12, 2017, 05:26:02 PM »
Hi Alexey,
Here is what I used:

Code: [Select]
chunk = PhotoScan.app.document.chunk
for i in range (len(chunk.cameras)):
    chunk.cameras[i].frames[0].path = chunk.cameras[i].path.replace(".jpg", ".tiff")

and here is what I got:
2017-01-12 08:19:21   File "S:/scripts/format_test_02.py", line 3, in <module>
2017-01-12 08:19:21     chunk.cameras.frames[0].path = chunk.cameras.path.replace(".jpg", ".tiff")
2017-01-12 08:19:21 AttributeError: 'PhotoScan.Camera' object has no attribute 'path'
Digital Mapping & Graphics LLC
https://digital-mapping.net/

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15029
    • View Profile
Re: Change path/replace photos
« Reply #9 on: January 12, 2017, 05:52:43 PM »
Ok, then it should be
Code: [Select]
chunk.cameras[i].frames[0].photo.path = chunk.cameras[i].photo.path.replace(".jpg", ".tiff")
I think you can also remove frames[0] element, unless you have multiframe chunk.
Best regards,
Alexey Pasumansky,
Agisoft LLC

bisenberger

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Digital Mapping & Graphics
Re: Change path/replace photos
« Reply #10 on: January 13, 2017, 08:12:14 AM »
Ok, then it should be
Code: [Select]
chunk.cameras[i].frames[0].photo.path = chunk.cameras[i].photo.path.replace(".jpg", ".tiff")
I think you can also remove frames[0] element, unless you have multiframe chunk.
That worked. Curious though, the extension in the photo panel is still jpg, but they are tiff's.

This will be very useful. I had some projects that i created with jpeg's to save on room, but want to reprocess them with tiff's. Won't have to start from scratch now.  8)
Thanks Alexey
Digital Mapping & Graphics LLC
https://digital-mapping.net/

adrian2608

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Change path/replace photos
« Reply #11 on: October 19, 2017, 08:13:53 PM »
Hi,

I know that this is a little bit "digging" the topic. But I have the same exact question. I tried with solutions in this topic, but doesn't work.

Agisoft Photoscan 1.3.0 build 3772

Can someone help. I have the opposite problem. I've used TIFF's, and like more JPG, because from My photo camera I'm processing RAW files, and the difference in quality between JPG and TIFF, is so tiny that is hard to notice in 500% close up.

And tiff's are killing My space on hard drive, while JPG's take well in comparison nothing.

Please help.

Best Regards,
Kamil.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15029
    • View Profile
Re: Change path/replace photos
« Reply #12 on: October 19, 2017, 08:31:06 PM »
Hello Kamil,

And what it the problem with the script? Note that the extensions are case sensitive, so "jpg" is not the same as "JPG".
Best regards,
Alexey Pasumansky,
Agisoft LLC

adrian2608

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Change path/replace photos
« Reply #13 on: October 20, 2017, 12:12:15 AM »
Hello Alexey,

Now it's working! Other question, is there a possibility to also change folder with images? Because now, We need to have them in the same destination. Not that important anyway, but good to know if possible.

Thank You for pointing out difference between JPEG, JPG, jpg etc.

Regards,
Kamil.

Hello Kamil,

And what it the problem with the script? Note that the extensions are case sensitive, so "jpg" is not the same as "JPG".

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15029
    • View Profile
Re: Change path/replace photos
« Reply #14 on: October 20, 2017, 01:22:33 AM »
Hello Kamil,

At first you can change the extension and then use Change Paths option from the Photos pane context menu.
Best regards,
Alexey Pasumansky,
Agisoft LLC