Saturday 19 May 2018

arcgis desktop - arcpy.Raster.save(*.jpg) - format unknown


The following Python script returns the error on the final line, "RuntimeError: ERROR 010093: Output raster format UNKNOWN is unsupported.":


import arcpy

inRaster = arcpy.Raster(r'C:/junk/raster.tif')
outRaster = r'C:/junk/out.jpg'
intermediateRas = inRaster
intermediateRas.save(outRaster)

The script runs to completion if outRaster is .tif or ESRI GRID. Why does this not work for .jpg (or .jpeg)? According to the list of supported raster formats, JPEG should work.



  • ArcGIS 10.2.2



Answer




JPEG is not supported as an output format:



The save method supports all raster formats supported by Spatial Analyst. In the example below the raster save method is used to save data to a file geodatabase raster and to IMAGINE format.



Supported raster 'save' formats for spatial analyst:



Output raster data formats The supported output raster formats are the following: Esri Grid Geodatabase rasters (This includes File, Personal, and ArcSDE geodatabases.) TIFF (.tif) ERDAS IMAGINE (.img) The location and name you specify for the output raster determines the format in which it is created.



When using raster.save your choices are Geodatabase Raster, Esri Grid, GeoTiff and ERDAS imagine format.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...