On Sun, 2014-11-30 at 12:40 -0500, Albert Cardona wrote:
Hi all,
I wonder whether the file is formed in such a way that inkscape has a hard time with it?
Google Chrome's file dialog can preview the file instantly and then renders it within 3 seconds, wheres Inkscape hangs for minutes when trying to preview it or to open it.
After download perhaps... it took a couple of minutes for me to download the file.
What inkscape does successfully is, in a few minutes, to save it as PDF from the command line using the -A switch. Saving to PDF shrinks the file from the original 8 MB down to ~800 KB.
As a PDF Inkscape has no problem previewing it instantly, and opening it within 20 seconds or so. It's the only way I managed to open the file with inkscape.
Given that we generate this file ourselves from our own software (github.com/acardona/CATMAID/), I would appreciate if someone could look at the SVG example file and let us know what would be best for Inkscape regarding formatting, choice of svg vs g elements, and styling.
Example files (original SVG and also the PDF as saved with inkscape -A):
https://www.dropbox.com/sh/d10pxph6b1kd77c/AABXs0TJhxDtlBPr6GZ_3bSQa?dl=0
I don't know why Inkscape takes so long to open the file but here are some quick observations:
1. The file begins with 13000 style declarations. This might in itself choke Inkscape (I am not sure).
2. Why is the style data being saved as CDATA? I don't see anything that requires this (but I didn't examine all 13000 lines).
3. Most of the styling classes are redundant. The only things that are changing on the lines is the color and the stroke-width. The other properties can be pulled out. And even then, you might group the objects with the same color and similar stroke width together. All the black lines seem to the same width and all the blue and red lines seem to have the same width. style97 (text) is the only really different style. All the black lines
3. Some of the properties are useless:
fill:none: Fill won't show on a straight line. stroke-opacity: 1; This is the default value. stroke-linejoin: round: There is no line join on a straight line.
4. The SVG standard requires rendering to an accuracy of 1px and it specifies that lengths are stored as floats, yet there is 17 digits for stroke-width. Ditto for line element values. Reducing this to something reasonable would reduce file size by at least 75%.
5. You have nested SVGs. Don't know if this is contributing or not.
Passing the file through PDF and back is probably getting rid of most of these things.
Tav