Returns the pixel width of a raster object in the spatial reference system as a float8 value. When the raster has no skew, the pixel width equals the X scale.
Syntax
float8 ST_PixelWidth(raster raster_obj)Parameters
| Parameter | Description |
|---|---|
raster_obj | The raster object to query. |
How it works
The pixel width is the length of one pixel measured along the X axis in the units of the spatial reference system. The red segment in the figure below illustrates this measurement.

No skew (common case): When skewX = 0, the pixel width equals the X scale — the straightforward ratio between geometric coordinates and raster pixels.
Examples
Rasters with no skew
Query the pixel width and pixel height together to confirm the resolution:
SELECT st_pixelwidth(rast), st_pixelheight(rast)
FROM raster_table; st_pixelwidth | st_pixelheight
---------------+----------------
60 | 60Both values are 60, which equals the X scale when there is no skew.