From a7fc9103a152d7f100f08300ebf54ba23f9a4ffb Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Tue, 6 Sep 2011 20:10:18 +0000 Subject: [PATCH] Fixed ST_AsPNG to allow rasters with four bands as that becomes a RGBA PNG image. git-svn-id: http://svn.osgeo.org/postgis/trunk@7815 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/rt_pg/rtpostgis.sql.in.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index 78c20ac1a..7875cea59 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -1154,8 +1154,7 @@ CREATE OR REPLACE FUNCTION st_asjpeg(rast raster, options text[] DEFAULT NULL) BEGIN num_bands := st_numbands($1); - -- JPEG only allows 1 or 3 bands - -- we only use the first + -- JPEG allows 1 or 3 bands IF num_bands <> 1 AND num_bands <> 3 THEN RAISE NOTICE 'The JPEG format only permits one or three bands. The first band will be used.'; rast2 := st_band(rast, ARRAY[1]); @@ -1230,9 +1229,9 @@ CREATE OR REPLACE FUNCTION st_aspng(rast raster, options text[] DEFAULT NULL) BEGIN num_bands := st_numbands($1); - -- PNG only allows 1 or 3 bands - IF num_bands <> 1 AND num_bands <> 3 THEN - RAISE NOTICE 'The PNG format only permits one or three bands. The first band will be used.'; + -- PNG allows 1, 3 or 4 bands + IF num_bands <> 1 AND num_bands <> 3 AND num_bands <> 4 THEN + RAISE NOTICE 'The PNG format only permits one, three or four bands. The first band will be used.'; rast2 := st_band($1, ARRAY[1]); num_bands := st_numbands(rast2); ELSE -- 2.50.0