1

I am using ArcGIS Desktop 10.1.

I need tiff orthos to have NO compression. I'm using a python script to parse through directories and add 4-band data to the images. It works great ... but the customer wants it uncompressed. The process creates them in LZW by default.

The copyraster info page states: out_rasterdataset --> "When storing a raster dataset to a JPEG file, JPEG 2000 file, TIFF file, or geodatabase, you can specify a compression type and compression quality."

How do I set the compression type to None?

I have tried arcpy.env.compression = "NONE" but this does NOT work. I even added the pyramid environment variable. No dice.

Here's what I'm using now and it works, but the compression is still LZW:

import os,arcpy,glob

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

arcpy.env.workspace = rasterpath arcpy.env.pyramid = "PYRAMIDS -1 BILNEAR NONE NO_SKIP" arcpy.env.compression = "NONE"

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")

In order to get no compression, I have to open each file and export data. If the no compression variable won't work in the current script, I'm fine with creating a new script. Basically, I want this screen in script form:

enter image description here

  • 1
    The documentation for CopyRaster claims that it acknowledges the Compression environment setting. If it's not working correctly, please submit it as a bug to ESRI. – Tom Jul 30 '18 at 20:20
  • 1
    LZW is lossless. Do you really need it to be None, or do you just need it to be lossless? – Tom Jul 30 '18 at 20:23
  • 1
    What version of ArcGIS are you using? Going back to 10.3, I'm not seeing TIFF included in that quote you gave about compression environments. – Tom Jul 30 '18 at 21:03
  • 1
    That said, my tests (in 10.5) are showing that CopyRaster to tif accepts my compression environment settings, both None and other. – Tom Jul 30 '18 at 21:12
  • 1
    You can't replace that window with a script...not without going all crazy with ArcObjects. Try using the RasterToOtherFormat tool instead. – Tom Jul 30 '18 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.