Sozi
Sozi copied to clipboard
Sozi 15: Linked Images are not displayed in editor
My SVG contains linked images such as the following example:
<image overflow="visible" width="3591" height="1954"
xlink:href="Folien/286.png"
transform="matrix(0.1585 0 0 0.1585 51.7483 1788.0493)">
</image>
However, the images are not displayed in the editor (Sozi-15.05.142313-win64):
Steps to reproduce:
- Create an empty svg
- Link a small png
- Open in Sozi 15
Thanks in advance! Marco
+1
It's great how @senshu is moving Sozi forward -- I tried to upgrade from the InkScape extension to Sozi 15 just yesterday, but the fact that linked images are not displayed was a show stopper for me.
Experimental support for linked images has been added recently. You can try the latest nightly build (15.06.202222) from https://drive.google.com/open?id=0ByRUreHgekjMWG9teGM2dE8wck0&authuser=0
Thanks a lot! Works like a charm with the latest build!
Best Regards, Marco
2015-06-28 9:44 GMT+02:00 Guillaume Savaton [email protected]:
Experimental support for linked images has been added recently. You can try the latest nightly build (15.06.202222) from https://drive.google.com/open?id=0ByRUreHgekjMWG9teGM2dE8wck0&authuser=0
— Reply to this email directly or view it on GitHub https://github.com/senshu/Sozi/issues/304#issuecomment-116212756.
The nightly doesn't appear to work with image embeds from OmniGraffle, which are of the form:
<image xl:href="image1.png" width="1024" height="1024" transform="translate(193.5 8.5) scale(.12792969)"/>
The output HTML contains this:
<image xl:href="image1.png" width="1024" height="1024" transform="translate(193.5 8.5) scale(.12792969)"></image>
Which looks as if it ought to work but does not appear to in the browser (the original .svg does).
Also verified that this still persists with the 15.06 release.
This is a simple .svg
created from OmniGraffle, which exhibits the problem. It expects to find image1.png
in the same directory and embeds it in the svg.
(As an aside, it would also be nice to have an export option that would embed all images in the HTML as base64 encoded data and use data URIs for them, so that you can distribute the presentation as a stand-alone file)
After a little bit of debugging, it appears that Sozi is not correctly handling XML namespaces. If the svg tag contains xmlns:xlink="http://www.w3.org/1999/xlink"
and the reference to the image is xlink:href="image1.png"
, then it all works fine. If, however, the svg tag contains xmlns:xl="http://www.w3.org/1999/xlink"
and the reference to the image is xl:href="image1.png"
, then Sozi doesn't understand the image.
@davidchisnall Thanks for investigating this issue. I am trying to fix this, but it seems that there are issues in Webkit:
- When the SVG is embedded inside an HTML document, Webkit refuses to display images if the "href" attribute is not prefixed by "xlink".
- It still doesn't work if Sozi adds "xmlns:xlink" and "xlink:href" attributes to the document.
I have no idea at the moment, but I will try again soon.
WebKit (at least, in Safari and Chromium on OS X) displays the image if it has foo:href
, for any value of foo
as long as in the svg
tag has xmlns:foo="http://www.w3.org/1999/xlink"
in it. It looks as if your fix ought to make it work, though simply replacing whatever prefix the creator used with xlink
in both places should also work and work around buggy SVG viewers.