question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some svg strings that work on the browser do not work with st.image

See original GitHub issue

Example 1:

Input:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100">
    <clipPath id="clipCircle">
        <circle r="25" cx="25" cy="25"/>
    </clipPath>
    <image href="https://avatars.githubusercontent.com/karriebear" width="50" height="50" clip-path="url(#clipCircle)"/>
</svg>

Output: image

Expected: image

Example 2:

Input

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="500" height="100">
<text x="0" y="50">"I am a quote" - https://avatars.githubusercontent.com/karriebear</text>
</svg>

Expected: image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
karriebearcommented, Sep 16, 2020

Thanks for that analysis and everything you said makes sense! Also agree with both your footnotes.

  1. It looks like svg currently do not honor new lines for text so we might as well get rid of them.
  2. This is for urls specifically so I don’t think it should be an issue. Safer definitely sounds better and a quick test of text elements looks like it should be fine (added as Example 2 above).
1reaction
karriebearcommented, Sep 10, 2020

Hi @yashshah1, you are more than welcome to take this on. Thank you for the help! We really appreciate it ☺️

Please let us know if you need any assistance. We’ll be happy to take a look at any draft PRs too. Once you’re ready, just submit a PR ready for review. Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

st.image does not render .svg files with other, common tags
As mentioned in this comment, st.image breaks when trying to display .svg files when there are other top-level tags that aren't svg tags....
Read more >
Chrome not rendering SVG referenced via <img> element
As you can see I am trying to use an svg file in both an img element and in css as a background...
Read more >
st.image - Streamlit Docs
st.image displays an image or list of images.
Read more >
Adding vector graphics to the web - Learn web development
This article has provided you with a quick tour of what vector graphics and SVG are, why they are useful to know about,...
Read more >
An SVG Primer for Today's Browsers - W3C
Publication as a Working Draft does not imply endorsement by the W3C Membership. ... Someone who has done some work with SVG but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found