Opened 12 years ago
#4145 new defect
imageObj.getBytes fails for CAIRO/SVG output format
Reported by: | panzel | Owned by: | sdlime |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | MapServer C Library | Version: | 6.0 |
Severity: | normal | Keywords: | mapscript, svg |
Cc: |
Description
Under SWIG/C#, the MapServer 6.0.1 imageObj.GetBytes() method fails if the imagetype is 'svg' and the outputformat is specified by:
OUTPUTFORMAT NAME "svg" DRIVER CAIRO/SVG MIMETYPE "image/svg+xml" IMAGEMODE RGB EXTENSION "svg" END
By comparison, it succeeds with imagetype 'png' with:
OUTPUTFORMAT NAME "png" DRIVER AGG/PNG MIMETYPE "image/png" IMAGEMODE RGB EXTENSION "png" FORMATOPTION "GAMMA=0.75" END
The short-term work-around is to use imageObj.save, which works with 'svg'.
I've attached two map files (m11.map, m12.map) that show the png/svg cases, and a C# file (Program.cs) that reads a map file and creates an output file. When run with m12.map (the svg case), the output is:
Drawing map: 'MS' using imageObj.getBytes GetBytes: getBytes: General error message. Failed to get image buffer;msSaveImageBuffer(): General error message. Unsupported image type
The C# code is copied almost intact from Tamas' http://mapserver.sourcearchive.com/documentation/5.2.0/getbytes_8cs-source.html. The original missed a "{0}" in the catch block's WriteLine statement.
This may be related to an older ticket: Ticket #3201, "GetBytes(), Write() on ImageObj results in error when parsing mapfile with AGG renderer in C# mapscript."