AnsweredAssumed Answered

Export Data arcpy command line to save Tiff raster with zero compression

Question asked by srobinson805 on Jul 30, 2018
Latest reply on Aug 22, 2018 by srobinson805

Hi guys. I have a script which cycles through a directory and adds 4band data. It works like a charm. The problem is that the customer wants the results UNcompressed. By default, all of the resulting files are compressed and so I have to manually open each file and then simply export data/raster to raster/compression set to zero. That works, but it's tedious and unnecessarily expensive in time.

 

I have looked everywhere I can to find out how to do the export process with zero compression by script. No luck, so I figured I'd try here.

 

Below is the currently functioning script.

 

----------------------------------------------------

import os,arcpy,glob

rasterpath = r"filepath-source"
outFolder = r"filepath-end"

arcpy.env.workspace = rasterpath

for rasterFile in arcpy.ListRasters("*.tif"):
    oName, oExt = os.path.splitext(rasterFile)
    outRaster = os.path.join(outFolder, oName+ ".tif")
    arcpy.CopyRaster_management(rasterFile,outRaster,"DEFAULTS","255","255","","","8_BIT_UNSIGNED")

 

-------------------------------------------------------

 

I know that the process of adding the band data creates pyramids, but my attempts to add zero compression to the environment on this script fails. What I'm looking for help with:

 

* the command line which will simply resave the data as-is but with no compression.

 

Compression is not an option for arcpy.CopyRaster_management in tiff format that I can find. There has to be a way to automate this. I'll be shooting myself if I have to manually open and resave hundreds of ortho images per object just for that single variable. I hope you guys can help! Thanks.

Outcomes