GNOME Bugzilla – Bug 108502
svg import failures
Last modified: 2019-03-20 11:05:17 UTC
I've created some svg files with sodipodi and sketch, but dia cannot import them. I tried other svg files apparently created using Adobe Illustrator, but they could not be imported either. Here are some I tried (provided in various Debian packages): /usr/share/icons/gnome/scalable/emblems/emblem-OK.svg /usr/share/doc/sodipodi/examples/tux.svg /usr/share/gdm/themes/circles/background.svg /usr/lib/Amaya/config/libconfig/arrow1.svg stdout will say things like ** (dia:6995): WARNING **: Could not find SVG namespace. ** (dia:6995): WARNING **: root element was 'svg' -- expecting 'svg'. A dia canvas window will open, but it contains no objects. dia _was_ able to successfully open svg files that it exported. :)
we will probably need to make this into a meta bug and create individual bug reports and determine which specific SVG features Dia is missing and what bugs there are. If there is any way to shift some blame to Sodipodi (and ill bet there is :) or Sketch (maybe, would not bet on it) then please do harass them into allowing simpler SVG that Dia wont choke on (but on the other hand be careful not to get us in trouble, make sure you have evidence before saying their SVG exporter sucks ;) - Alan
How about running dia against a test suite? http://www.w3.org/Graphics/SVG/Test/
Why run a test suite if we already know it is higly limited ? http://mail.gnome.org/archives/dia-list/2003-May/msg00031.html BTW: there is a somewhat better svg import implemented by : [reasonable patches are accepted :-]
2003-05-11 Hans Breuer <hans@breuer.org> * plug-ins/python/diasvg_import.py : (new file) which currently is mainly a stress test for PyDia but for some files already produces better results than svg-import.c
*** Bug 116326 has been marked as a duplicate of this bug. ***
*** Bug 140835 has been marked as a duplicate of this bug. ***
Can't pass the buck. Dia can't even import svg's it has created itself :( as of v.93
*** Bug 150722 has been marked as a duplicate of this bug. ***
*** Bug 169191 has been marked as a duplicate of this bug. ***
The svg import code is known to be limited, in fact plug-ins/svg/svg-import.c does not handle "path" at all. [It does not handle other things as well. Like nested groups, transforms, gradients, etcpp. The real solution may be to throw away all the import code and start from scratch with a capable svg library like http://cvs.cairographics.org/libsvg/ which is derived from librsvg but does not render itself. Some small improvement would be possible by sharing more code with objects/custom/shape_info.c which can handle pathes to some extent.
Some progress: 2005-03-06 Hans Breuer <hans@breuer.org> * lib/diasvgenderer.c(draw_arc|fill_arc) : finally correct sweep and large_arc, thus produce correct arc output (like diasvg.py does;), fixes bug #144401 * lib/dia_svg.[hc](dia_svg_parse_path) : new function copied and adapted from objects/custom/shape_info.c to be shared with object/custom and plug-in/svg -> finally the C based svg-import reads pathes again. Added arc parsing while I was there, which fixes bug #169191 * objects/custom/shape_info.c(parse_path) : * plug-ins/svg/svg-import : reuse above function Also fix the "root element was 'svg' -- expecting 'svg'" bug #108502. But in general this does only support a small subset of what is possible in SVG.
*** Bug 172105 has been marked as a duplicate of this bug. ***
For further testing, there are many examples at www.openclipart.org. Many of them show strange errors. Just make sure to load as SVG not pixbuf[svg]. -Lars
pixbuf[svg] is based on librsvg which certainly understands much more SVG than both Dia SVG importers together. But it is rendering a bitmap from the SVG, which is probably not what one wants to import into Dia.
Importing SVG in GIMP crop images. I have several examples of this svg import bug. On dragging SVG files, some SVG files are cropped (cutted) on edges or even more (half of source SVG is cutted sometimes). I would like to send some SVG for example, but this forum don't let us attach files. Thank you
Sorry, I fails to to see the connection between the GIMP cropping images and Dia's svg import failure - which this bug report is about. If also Dia has import issues with the same files you can attach them with the "Create a New Attachment" link below.
*** Bug 600530 has been marked as a duplicate of this bug. ***
Created attachment 270689 [details] SVG 1.1 Conformance Suite Implementation Status including Dia There is long list of svg improvements with the current development version: 4634f66 svg: avoid duplicated IDs in examples, if ... 80a86bb svg: plug memory leaks triggered by gradient-variations.svg acbfa87 svg: plug memory leaks triggered by path-variations.svg ab97346 svg: improve stroke-dasharray import with odd number of values 3456c28 svg: respect xml:space="preserve" 25cebf1 svg: fix xmlGetNsProp() for "xlink:href" 24505d7 [gradient] svg: stop-(color|opacity) from style and gradientTransform bab958b svg: parse defines before objects bb1e739 svg: typos and whitespace d69490c [gradient] svg: import gradients and set them on objects 85ea964 svg: support 'color' attribute and 'currentColor' value at import d7f0c6a svg: support for external SVG in <image/> 1bd7d96 svg: warn about a closed path with just two points fdebfc6 svg: respect "inherit" and some bezier robustness 98d4602 svg: closed-by-style was too greedy ef17ad0 svg: more path-variations including CSS 920bad7 svg: remove second setting of xmlns 3e5634b svg: comment on <use/> styling and a leak fix eb21fea svg: improve closed-by-style (path and polyline) dc61e85 svg: improved viewBox interpretation 41791a6 svg: fix some text transform 4303a22 svg: support class list lookup for CSS 885648b svg: named color fixes (no more pango_color_parse()) be5f46e [transform] svg: fix PyDia::SvgRenderer::draw_object(..,matrix) 4e9c7a0 svg: activate viewBox interpretation again on import 3527314 svg: add svgz to extensions for svg-import 1c47dae svg: fix interpretation of units inch and pica 5516542 svg: set fill-rule also for polygon rendering 3b8f496 svg: support the full set of named colors 4c7a083 svg: group transforms now pass the W3C SVG test suite ba9eeba svg: Fix <ellipse/> roundtrip (width = rx * 2) 8fe43e2 svg: fix <tspan/> roundtrip (it's position is not relative to >text/> 416885f svg: line-join support for "Standard - Box" 7f515fb svg: fix leak in _parse_shape_cp() 99c7f1a svg: use x,y from first <tspan/> as offset cff308b svg: style tweaks fa585f2 svg: tweak polyline creation 6c7fd57 svg: improve matrix parsing and handling 83ebe80 svg: dia_svg_parse_path() vs TestSuite - path end handling 23c9f93 svg: path codes 'q' and 't' debugged ddca5a3 svg: write Dia's only fill-rule used 1dabb5c svg: Fix stroke-dasharray round-trip e785c0a svg: parse font-* and text-* also as attributes 5444eb0 svg: CSS style lookup also for tag alone 30aab3f svg: support last two path code Q and T 4726006 svg: enable <defs/> definitions and referencing c1e1468 svg: support linejoin and linecap style and attribute 8221c62 svg: font style parsing improvements a79de88 svg: support parsing of 12 bit color 9705ca3 svg: initial support for CSS style for svg-import 7e76611 svg: split style string parsing to it's own function 2f79a3f svg: support multiplicative opacity f5f07f1 svg: comment on ignored <defs/> 5eb2792 svg: consume transform="skew..." 3ddf113 svg: transform parsing robustness 437cafd svg: parse comments to meta info c2c0182 svg: more samples/path-variations.svg 43b8b3d svg: set show_background=false for full transparent fill 76416b8 svg: finally fix offset coming from group transform 3b7dd34 svg: set un-parsable color to none again bf9e638 svg: matherr avoidance was a bit too cautious 6e36a79 svg: fix over-filling if only fill-opacity="0" is given 0492877 svg: adjust coloring order for <use/> 875ad6a svg: improve group-to-layer support 526c8b7 svg: improve transform support for <use/> 2f894fd svg: stroke-dasharray=none makes a solid line 10a3da6 svg: allow to paste from clipboard via 'Edit/Paste Image' 52a7bb3 svg: fix MULTI_MOVE_BEZIER (removable of endless loop) bff01fb svg: finally support all SVG named colors (plus some dox) feb6fbf svg: initial (hidden) shape import - no round-trip yet 1541c6a svg: extend dia_svg_parse_path() to support multiple move-to 1c40554 svg: almost working round-trip with cairo/svg 647ce81 svg: layer import/export via named groups <g id="LayerName"></g> e98c6e2 svg: no more message_*() calls in the SVG plug-in b27a03f [custom] Fix some subshape cases and add svg:rect:(rx|ry) 85899d7 svg: style="stroke-dasharray:none;" gives a solid line now 71090b4 svg: retain current point over path split a3596fe svg: embedded image support for import 50108da svg: export images inline if there is no filename 7595626 Don't ignore style given by <svg:g ... subshape="true"> fb44972 Bug 607564 - custom shape svg:text elements positioned wrong a759f2b [meta info] Store Object:meta:url as <svg:a href=".."> fbf01f0 incomplete description of <svg:text> Maybe more because the list above is only created by git log --oneline|grep svg: >svg-improvement.log But there are some areas I still consider out of scope for Dia, e.g. - animations: Dia is designed for static diagrams - filters: IMO not desirable for performance reasons - interact: wont embedded a JavaScript engine to Dia - masking: would require significant extension to Dia's rendering model - marker: if pattern supoort would be implmented, this could be reconsidered - pattern: would require at least partial mask support - text path and other text effects: would be nice, but somewhere we have to draw the line See the attached file for a commented run of Dia against the W3C SVG Test Suite: http://www.w3.org/Graphics/SVG/Test/20110816/status/implementation_matrix.html
+1 for the earlier comment to use an existing SVG library rather than maintaining a separate import filter. It'd allow for synergy effects with other projects.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/dia/issues/78.