Opened 21 years ago

Closed 21 years ago

#366 closed defect (wontfix)

label backgrounds not always transparent

Reported by: cpurvis@… Owned by: warmerdam
Priority: high Milestone:
Component: GDAL Support Version: 4.0
Severity: normal Keywords:
Cc:

Description

From Frank:

The background areas in the transparent case are being used internally as 
transparent, but for some reason the transparency is being burned into the 
output raster when it should just let us see the layer underneath.

This seems like a bug in my RGBA handling in MapServer.

From Charlton:

Whenever I enable (STATUS ON) one of my layers that has a TRANSPARENCY value 
associated w/ it, my labels go from having no background to having a white 
background.  This is a problem since I don't want to use a black text on white 
background.

Here are two samples.  The "good" one is how I would like the image to look 
even w/ the transparent layer on.  The "bad" one is how it currently looks (w/ 
the transparent layer on).  Don't look for the transparent layer, though, 
since I gave it a bogus expression to keep the image simple.

Any ideas?

Good image (w/o transparent layer on): http://caro-
coops.org/~cpurvis/misc/good_labels_no_trans.png

Bad image (w/ transparent layer on): http://caro-
coops.org/~cpurvis/misc/bad_labels_with_trans.png

  IMAGETYPE png
  OUTPUTFORMAT
    NAME png
    DRIVER "GD/PNG"
    MIMETYPE "image/png"
    IMAGEMODE RGBA
    EXTENSION "png"
    TRANSPARENT ON
  END
...
    CLASS
      NAME "streets_label"
      COLOR 0 0 0
      MAXSCALE 50000
      LABEL
        TYPE TRUETYPE
        FONT "arial-bold"
        SIZE 8
        POSITION AUTO
        ANGLE AUTO
        COLOR 255 255 0
      END
    END
 
I'm assuming that keeping TRANSPARENT ON w/i only the OUTPUTFORMAT block is 
the right thing to do.

MS 3.7, gdal-1.1.8, gd-2.0.15

Attachments (4)

out.png (19.3 KB ) - added by fwarmerdam 21 years ago.
Output I get from test map ... seems to overlay ok.
bug366.zip (25.9 KB ) - added by fwarmerdam 21 years ago.
test map and required data
error.png (17.3 KB ) - added by cpurvis@… 21 years ago.
test map w/ new shapefile addition; overlay problem
wrk_with_shapefile.zip (96.9 KB ) - added by cpurvis@… 21 years ago.
test map w/ new shapefile and required data

Download all attachments as: .zip

Change History (11)

comment:1 by cpurvis@…, 21 years ago

Summary: legend backgrounds not always transparentlabel backgrounds not always transparent

comment:2 by fwarmerdam, 21 years ago

Status: newassigned
OK, I have tried, but been unable to reproduce this so far. 

I am using MapServer from CVS and a recent gd. 

I put together this map file to test, basically a raster layer with one
label overlayed on it.  I have attached the mapfile and data files used in
my attempt.  I would appreciate your downloading the attachment and seeing
if you get the same output as I did with the mapfile, or if you get your
original problem. 

#
# Tests labelling into an RGBA result.
#
# REQUIRES: SUPPORTS=FREETYPE OUTPUT=PNG
#
MAP
  NAME test
  IMAGETYPE png

  OUTPUTFORMAT
    NAME png
    DRIVER "GD/PNG"
    IMAGEMODE RGBA
    TRANSPARENT ON
  END

  SIZE 400 400
  SIZE 400 300
  EXTENT 0 0 400 300
  UNITS meters
  FONTSET fonts.lst

  SYMBOL
    NAME "circle"
    TYPE ellipse
    FILLED true
    POINTS 1 1 END
  END

  LAYER
    NAME fonttest
    TYPE POINT
    STATUS DEFAULT
    FEATURE
      POINTS 200 200 END
      TEXT "BIG_AND_small test"
    END
    CLASS
       COLOR 0 0 0 
       LABEL
        COLOR 255 255 0
        FONT lucida
        POSITION AUTO
        ANGLE AUTO
        TYPE truetype
        SIZE 20
      END
    END # CLASS
  END

LAYER
  NAME grey
  TYPE raster
  STATUS default
  DATA pct22.tif
END
END

by fwarmerdam, 21 years ago

Attachment: out.png added

Output I get from test map ... seems to overlay ok.

by fwarmerdam, 21 years ago

Attachment: bug366.zip added

test map and required data

comment:3 by fwarmerdam, 21 years ago

I would add you should be able to run the test map by cd'ing into the
directory and running "shp2img -m wrk.map -o out.png" possibly adding an
appropriate path to the shp2img executable. 

If the given map works fine for you, please try to construct a similarly
self contained example that demonstrates your problem. 

by cpurvis@…, 21 years ago

Attachment: error.png added

test map w/ new shapefile addition; overlay problem

by cpurvis@…, 21 years ago

Attachment: wrk_with_shapefile.zip added

test map w/ new shapefile and required data

comment:4 by cpurvis@…, 21 years ago

If I replace my truetype label definition w/ a bitmap type, there is no 
problem.

comment:5 by fwarmerdam, 21 years ago

Charlton, 

I have tried again to reproduce this with no success.  I do not get the odd
effects around the text with RGBA output and the sc_health partially transparent
layer enabled. 

Could you attach what you get from shp2img?  

I think you will need to upgrade to MapServer from CVS.  You mentioned earlier
that the version was 3.7 which I assume is a not quite up to date with what is in
CVS, right?  There have been fixes in this area of functionality in recent
months so it may already be fixed.

comment:6 by cpurvis@…, 21 years ago

Bravo, Frank!  Upgrading from 3.7dev to 4.0 did the trick.  Thanks for all 
your help and troublshooting.

(Don't know how you want to leave the bug status.  I'll leave that in your 
hands.)

Thanks again,

Charlton

comment:7 by fwarmerdam, 21 years ago

Resolution: wontfix
Status: assignedclosed
Charlton, 

That's good news. 

I am not interested in digging around in 3.6.x since so I will just close it. 
Note: See TracTickets for help on using tickets.