ST_Resize — 調整影像大小至新的寬度/高度
raster ST_Resize(
raster rast, integer width, integer height, text algorithm=NearestNeighbor, double precision maxerr=0.125)
;
raster ST_Resize(
raster rast, double precision percentwidth, double precision percentheight, text algorithm=NearestNeighbor, double precision maxerr=0.125)
;
raster ST_Resize(
raster rast, text width, text height, text algorithm=NearestNeighbor, double precision maxerr=0.125)
;
調整影像大小至新的寬度/高度。新的寬度/高度可以使用像素的確切數量或影像寬度/高度的百分比來指定。新影像的範圍將與提供的影像的範圍相同。
新的像素值是使用 NearestNeighbor(英文或美式拼寫)、Bilinear、Cubic、CubicSpline 或 Lanczos 重新取樣演算法計算的。預設值是 NearestNeighbor,它是最快的,但會導致最差的內插。
變體 1 預期輸出影像的實際寬度/高度。
變體 2 預期介於零 (0) 和一 (1) 之間的十進制值,表示輸入影像寬度/高度的百分比。
變體 3 接受輸出影像的實際寬度/高度,或文字百分比("20%")表示輸入影像寬度/高度的百分比。
可用性:2.1.0 需要 GDAL 1.6.1+
WITH foo AS( SELECT 1 AS rid, ST_Resize( ST_AddBand( ST_MakeEmptyRaster(1000, 1000, 0, 0, 1, -1, 0, 0, 0) , 1, '8BUI', 255, 0 ) , '50%', '500') AS rast UNION ALL SELECT 2 AS rid, ST_Resize( ST_AddBand( ST_MakeEmptyRaster(1000, 1000, 0, 0, 1, -1, 0, 0, 0) , 1, '8BUI', 255, 0 ) , 500, 100) AS rast UNION ALL SELECT 3 AS rid, ST_Resize( ST_AddBand( ST_MakeEmptyRaster(1000, 1000, 0, 0, 1, -1, 0, 0, 0) , 1, '8BUI', 255, 0 ) , 0.25, 0.9) AS rast ), bar AS ( SELECT rid, ST_Metadata(rast) AS meta, rast FROM foo ) SELECT rid, (meta).* FROM bar rid | upperleftx | upperlefty | width | height | scalex | scaley | skewx | skewy | srid | numbands -----+------------+------------+-------+--------+--------+--------+-------+-------+------+---------- 1 | 0 | 0 | 500 | 500 | 1 | -1 | 0 | 0 | 0 | 1 2 | 0 | 0 | 500 | 100 | 1 | -1 | 0 | 0 | 0 | 1 3 | 0 | 0 | 250 | 900 | 1 | -1 | 0 | 0 | 0 | 1 (3 rows)