From: Bborie Park Date: Tue, 6 Sep 2011 20:10:18 +0000 (+0000) Subject: Fixed ST_AsPNG to allow rasters with four bands as that becomes a RGBA PNG image. X-Git-Tag: 2.0.0alpha1~1039 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7fc9103a152d7f100f08300ebf54ba23f9a4ffb;p=postgis 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 --- 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