#1231 closed defect (fixed)
Transparency and 24 bits PNG output
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | MapServer C Library | Version: | 4.4 |
Severity: | normal | Keywords: | |
Cc: |
Description
8 bits PNG with Transparency set in the map file is OK. But using the default PNG24 output does not produce transparency. PNG24 does not produce 24 bits PNG but 8 bits PNG instead. Fix guideline : in mapoutput.c #if defined(USE_GD_PNG) && GD2_VERS > 1 if( strcasecmp(driver,"GD/PNG24") == 0 ) { format = msAllocOutputFormat( map, "png24", "GD/PNG" ); format->mimetype = strdup("image/png24"); // MJ : because mimetype is used to define output format later on format->imagemode = MS_IMAGEMODE_RGB; format->extension = strdup("png"); format->renderer = MS_RENDER_WITH_GD; format->bands = 3; format->transparent = map->transparent; // MJ for transparency } #endif /* USE_GD_PNG */ Marc
Change History (8)
comment:1 by , 19 years ago
Cc: | added |
---|
comment:4 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I have changed the 24bit mime type to "image/png; mode=24bit". This should allow it to be selected independently from the 8bit png type.
comment:5 by , 19 years ago
I should add the change was only made in 4.5. I'm a little leery about backporting it into 4.4.2 but the change is certainly small. Anyone else have an opinion?
comment:6 by , 19 years ago
Assuming it works in 4.5 this seems ok to me to move to 4.4.2. This bug had to topics, transparency and mime-type. Is the transparency issue still out there? Steve
comment:7 by , 19 years ago
Marc suggested making png24 support an alpha layer, but that would really make it png32. I'm not terribly opposed to *adding* a png32 but I don't think it should replace png24. So, in short, I don't think that the suggested change for transparency is a good idea. The user always has the option of declaring a 32bit output format in their map file with transparency enabled. I will backport the mimetype change to 4.4.2.
comment:8 by , 19 years ago
This change broke the writeOutputformatobject() in mapfile.c: the space in the "image/png; mode=24bit" value confuses the parser. I'll add quotes around all string values in writeOutputformatobject() and backport to 4.4.x
Note:
See TracTickets
for help on using tickets.