Opened 13 years ago

Closed 13 years ago

#3839 closed defect (invalid)

$map->outputformat->set('imagemode', MS_IMAGEMODE_RGBA); does not make the png transparent

Reported by: iap Owned by: aboudreault
Priority: normal Milestone:
Component: MapScript-PHP Version: 6.0
Severity: normal Keywords:
Cc: aboudreault

Description

$map->outputformat->set('imagemode', MS_IMAGEMODE_RGBA); does not make the png transparent

Version and Os: "php5-mapscript_6.0.0~beta5-1~lucid1_amd64.deb"

Note1: Works if set directly from mapfile

Note2: Works in 5.6

Test case:

$map->selectOutputFormat('png');
$map->save(TMP_PATH . DIR_SEP . 'before');
$map->outputformat->set('imagemode', MS_IMAGEMODE_RGBA);
$map->save(TMP_PATH . DIR_SEP . 'after');

File "before":

OUTPUTFORMAT
    NAME "png"
    MIMETYPE "image/png"
    DRIVER "AGG/PNG"
    EXTENSION "png"
    IMAGEMODE RGB
    TRANSPARENT FALSE
    FORMATOPTION "QUANTIZE_FORCE=ON"
    FORMATOPTION "QUANTIZE_DITHER=OFF"
    FORMATOPTION "QUANTIZE_COLORS=256"
    FORMATOPTION "INTERLACE=OFF"
  END # OUTPUTFORMAT

File "after":

OUTPUTFORMAT
    NAME "png"
    MIMETYPE "image/png"
    DRIVER "AGG/PNG"
    EXTENSION "png"
    IMAGEMODE RGBA
    TRANSPARENT FALSE
    FORMATOPTION "QUANTIZE_FORCE=ON"
    FORMATOPTION "QUANTIZE_DITHER=OFF"
    FORMATOPTION "QUANTIZE_COLORS=256"
    FORMATOPTION "INTERLACE=OFF"
  END # OUTPUTFORMAT

Change History (2)

comment:1 by aboudreault, 13 years ago

In fact, if we simply put IMAGEMODE RGBA in our initial mapfile and do a saveImage... there is no transparence. Not sure why... checking the code.

comment:2 by aboudreault, 13 years ago

Resolution: invalid
Status: newclosed

Things, work using:

$map->outputformat->imagemode = MS_IMAGEMODE_RGBA;
$map->outputformat->transparent = MS_TRUE;

You have to set the transparent to TRUE.

Note: See TracTickets for help on using tickets.