ST_AsPNG — Return the raster tile selected bands as a single portable network graphics (PNG) image (byte array). If 1, 3, or 4 bands in raster and no bands are specified, then all bands are used. If more 2 or more than 4 bands and no bands specified, then only band 1 is used. Bands are mapped to RGB or RGBA space.
bytea ST_AsPNG(
raster rast, text[] options=NULL)
;
bytea ST_AsPNG(
raster rast, integer nband, integer compression)
;
bytea ST_AsPNG(
raster rast, integer nband, text[] options=NULL)
;
bytea ST_AsPNG(
raster rast, integer[] nbands, integer compression)
;
bytea ST_AsPNG(
raster rast, integer[] nbands, text[] options=NULL)
;
Returns the selected bands of the raster as a single Portable Network Graphics Image (PNG). Use ST_AsGDALRaster if you need to export as less common raster types. If no band is specified, then the first 3 bands are exported. There are many variants of the function with many options. If no srid
is specified then then srid of the raster is used. These are itemized below:
nband
is for single band exports.
nbands
is an array of bands to export (note that max is 4 for PNG) and the order of the bands is RGBA. e.g ARRAY[3,2,1] means map band 3 to Red, band 2 to green and band 1 to blue
compression
number from 1 to 9. The higher the number the greater the compression.
options
text Array of GDAL
options as defined for PNG (look at create_options
for PNG of ST_GDALDrivers). For PNG valid one is only ZLEVEL (amount
of time to spend on compression -- default 6)
e.g. ARRAY['ZLEVEL=9'].
WORLDFILE is not allowed since the function
would have to output two outputs. Refer to GDAL
Raster format options for more details.
Availability: 2.0.0 - requires GDAL >= 1.6.0.