mapfish-print
mapfish-print copied to clipboard
SVG rendering does not work for non-RGBA pngs at native scale
mapfish-print version: 3.14.1
Running this example which renders a PNG icon using the mapfish-print CLI, the following error occurs:
Exception in thread "main" org.apache.batik.bridge.BridgeException: null:0
The URI "data:image/png;[...]"
on element <image> can't be opened because:
PNG URL is corrupt or unsupported variant
The example contains the following PNGs:
Seilbahn_22.png: PNG image data, 22 x 22, 8-bit colormap, non-interlaced
Seilbahn_22_RGBA.png: PNG image data, 22 x 22, 8-bit/color RGBA, non-interlaced
Any of the following changes make the error disappear, i.e. it happens only at a specific icon scale, with SVG rendering enabled, and with a non-RGBA png:
- Remove
defaultToSvg: truefromconfig.yaml - Replace
"externalGraphic": "Seilbahn_22.png"=>"externalGraphic": "Seilbahn_22_RGBA.png"inrequestData.json - Replace
"graphicWidth": 6.23=>"graphicWidth": 10inrequestData.json - Replace
"dpi": 254=>"dpi": 400inrequestData.json
(note that the combination of 254 dpi and graphicWidth 6.23 points was chosen on purpose to get the icon rendered with size 22x22 pixels which is the pixel size of the png file, 6.23 / 72 * 254 => 22)