mapfish-print icon indicating copy to clipboard operation
mapfish-print copied to clipboard

SVG rendering does not work for non-RGBA pngs at native scale

Open romanzoller opened this issue 7 years ago • 0 comments

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: true from config.yaml
  • Replace "externalGraphic": "Seilbahn_22.png" => "externalGraphic": "Seilbahn_22_RGBA.png" in requestData.json
  • Replace "graphicWidth": 6.23 => "graphicWidth": 10 in requestData.json
  • Replace "dpi": 254 => "dpi": 400 in requestData.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)

romanzoller avatar Jul 10 '18 11:07 romanzoller