Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: dyoung on January 04, 2020, 05:48:09 PM

Title: How to export BigTIFF orthomosaic from v1.6 Python API?
Post by: dyoung on January 04, 2020, 05:48:09 PM
Hello -- version 1.6 dropped exportOrthomosaic() and now uses exportRaster() with source_data=Metashape.OrthomosaicData. However, exportRaster() does not have a tiff_big parameter like exportOrthomosaic() did. How do I export a BigTIFF using this function? I have tried the following, but it does not work.

Metashape.ImageCompression.tiff_big = True
doc.chunk.exportRaster(path="path/to/file.tif", source_data=Metashape.OrthomosaicData)


I need to use a BigTIFF because with normal TIFF settings, I get: libtiff error: Maximum TIFF file size exceeded

Thank in advance for any help!
Derek
Title: Re: How to export BigTIFF orthomosaic from v1.6 Python API?
Post by: Alexey Pasumansky on January 04, 2020, 06:54:32 PM
Hello Derek,

Please see the example below (for version 1.6.0):

Code: [Select]
compression = Metashape.ImageCompression()
compression.tiff_big = True
chunk.exportRaster(path = "path/to/file.tif", source_data=Metashape.OrthomosaicData, compression = compression)
Title: Re: How to export BigTIFF orthomosaic from v1.6 Python API?
Post by: dyoung on January 04, 2020, 08:06:23 PM
Ah that makes sense! That worked with a slight modification of the last parameter:

image_compression = compression

Thanks!
Title: Re: How to export BigTIFF orthomosaic from v1.6 Python API?
Post by: Alexey Pasumansky on January 04, 2020, 08:15:29 PM
Yes, it should be image_compression, sorry for the confusion.
Title: Re: How to export BigTIFF orthomosaic from v1.6 Python API?
Post by: sven_a on January 07, 2020, 06:52:31 PM
Thank I had a similar question. Big tiff is now working.
How can I export data with TiffCompressionLZW?

Thanks! :)
Title: Re: How to export BigTIFF orthomosaic from v1.6 Python API?
Post by: Alexey Pasumansky on January 08, 2020, 02:39:48 PM
Hello Sven,

You should use the corresponding parameter of ImageCompression class:
Code: [Select]
compression = Metashape.ImageCompression()
compression.tiff_compression = Metashape.ImageCompression.TiffCompressionLZW
chunk.exportRaster(path = "path/to/file.tif", source_data=Metashape.OrthomosaicData, image_compression = compression)