[mapserver-users] Using IMAGECOLOR to create a transparency mask
Steve.Lime at dnr.state.mn.us
Thu Feb 5 15:42:11 EST 2009
AGG always produces 24-bit (or 32-bit) output. The documentation relates more to the GD driver I guess. The
default behavior with GD is that the first color allocated (which is always IMAGECOLOR) becomes transparent
if TRANSPARENT ON is set. The way to get 8-bit output out of GD is to either quantize to 256 or fewer colors
or force a predefined palette. Both are controlled via format options. I'm not positive about what happens with
transparency in those instances but you can give it a try.
>>> On 2/5/2009 at 2:03 PM, in message
<70fbea790902051203k5fa95dc6i59895f071e1abd14 at mail.gmail.com>, Glenn Waldron
<gwaldron at gmail.com> wrote:
> Hi Steve,
> I am trying to achieve the transparency effect as described in the
> "IMAGECOLOR [r] [g] [b]Color to initialize the map with (i.e. background
> color). When transparency is enabled (TRANSPARENT ON) for the typical case
> of 8-bit pseudocolored map generation, this color will be marked as
> transparent in the output file palette. Any other map components drawn in
> this color will also be transparent, so for map generation with transparency
> it is best to use an otherwise unused color as the background color."Perhaps
> I'm not clear on what constitutes "8-bit pseudocolored map generation". I am
> using the AGG/PNG driver with TRANSPARENT ON.
> Glenn Waldron : Pelican Mapping : http://pelicanmapping.com :
> On Thu, Feb 5, 2009 at 2:04 PM, Steve Lime <Steve.Lime at dnr.state.mn.us>wrote:
>> IMAGECOLOR just sets the background color for an image.
>> >>> On 2/5/2009 at 1:02 PM, in message
>> <70fbea790902051102p52a8067ar643666f0562642f3 at mail.gmail.com>, Glenn
>> <gwaldron at gmail.com> wrote:
>> > Hi Thomas,
>> > In that case maybe I am misunderstanding the purpose of IMAGECOLOR. What
>> > it supposed to do, if not make all pixels of the specified color
>> > transparent?
>> > Glenn Waldron : Pelican Mapping : http://pelicanmapping.com :
>> > +1.703.652.4791
>> > On Thu, Feb 5, 2009 at 1:24 PM, thomas bonfort
>> > <thomas.bonfort at gmail.com>wrote:
>> >> On Thu, Feb 5, 2009 at 14:43, Glenn Waldron <gwaldron at gmail.com> wrote:
>> >> > Stephen,
>> >> >
>> >> > However, I am trying to
>> >> > get the pixels in the final composited image to be completely
>> >> transparent.
>> >> >
>> >> There's no way you can set pixels to become transparent once the image
>> >> is saved with the AGG outputformat.
>> >> regards,
>> >> thomas
More information about the mapserver-users