]> granicus.if.org Git - postgis/commitdiff
Fixed ST_AsPNG to allow rasters with four bands as that becomes a RGBA PNG image.
authorBborie Park <bkpark at ucdavis.edu>
Tue, 6 Sep 2011 20:10:18 +0000 (20:10 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Tue, 6 Sep 2011 20:10:18 +0000 (20:10 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7815 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_pg/rtpostgis.sql.in.c

index 78c20ac1a570ad41b4a2a623b867d1bdd53092af..7875cea5902bdf5d1eea335a71804e8cccdaa1b0 100644 (file)
@@ -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