Solved! Go to Solution.
import arcpy raster = 'some/path/to/a/raster.tif' description = arcpy.Describe(raster) cellsize = description.children[0].meanCellHeight print cellsize
import arcpy raster = 'some/path/to/a/raster.tif' description = arcpy.Describe(raster) cellsize = description.children[0].meanCellHeight print cellsize
For clarification purposes only, this code will work only in the python window within ArcMap and not within a stand-alone script.
If you need to run this in a separate python script (using ArcMap 10.5), you may need to add the creation of the raster element between of the declaration of the path for the raster and the Describe process.
In my case, if I wasn't creating the Raster element first, I would get an error stating that the list index was out of range cause by, according to my tests, the missing children[0] portion of the code above.
As such, below is the revised version of the code for usage within a python script.
import arcpy
rasterpath = 'some/path/to/a/raster.tif'
raster= arcpy.Raster(rasterpath)
description = arcpy.Describe(raster)
cellsize1 = description.children[0].meanCellHeight # Cell size in the Y axis and / or
cellsize2 = description.children[0].meanCellWidth # Cell size in the X axis
arcpy.AddMessage(str(cellsize1)) # If you want to show the result in the processing window