Large bitmaps inside SVGs are not displayed

Discussions about the wiki documentation of FreeCAD and its translation.
vocx
Posts: 4073
Joined: Thu Oct 18, 2018 9:18 pm

Large bitmaps inside SVGs are not displayed

Postby vocx » Sat Dec 14, 2019 11:13 pm

I tried uploading a large SVG file that has an embedded bitmap image (PNG).

I did it this way because the PNG image shows static information, and with Inkscape I add annotations, text, arrows, squares and similar vector graphics.

The image is this one https://www.freecadweb.org/wiki/File:Fr ... isions.svg

This should work fine, but the wiki doesn't display it. You can however, download it and open it fine in your computer.

The wiki shows this error: "Invalid SVG file: Expected <svg> tag, got in NS"

I investigated the problem and it seems the MediaWiki software has a limit on the size of the SVG files that it will show. Since an SVG is an XML file that has a shape description language, its contents are normally just text, so the software expects to parse a small file (maybe less than 50 KB). However, when it includes the bitmap image, there is a lot of binary information embedded in the file, and the wiki fails parsing the file. This file in particular is around 350 KB, which isn't very big for a bitmap image, but it is for an SVG.

It seems the solution is to set the variable "wgSVGMetadataCutoff" to a larger value in the configuration files of the wiki, which only administrators can do.

Reference:
* Invalid SVG files (Using Inkscape)
* Thumbnails of certain SVG files fail to render

Meanwhile to solve this issue, I convert the entire SVG file to a static PNG, and this is displayed correctly.

https://www.freecadweb.org/wiki/File:Fr ... isions.png
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.