Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

SVG image format

  1. Oct 11, 2015 #1
    I access the forums from iPad or Android, and it's really hard to draw images on them. The apps are less than awesome, and most online editors (including PF whiteboard) require Flash support, which is not available on mobile devices. Javascript online editors often don't work.
    When they do, I draw something and try to download the image, I get things like


    instead of the image, and it can't be used as URL in Upload.

    So I came up with the idea that SVG images can be written in a text editor. Some online editors even allow you to draw and then copy the SVG as text. Would it be possible to
    1) Add SVG as the supported image format?
    2) Add to Upload button a possibility to create a new file with contents of an edit box? This is a trivial task on a computer, but mobile devices are really limited in these things.
    3) Integrate SVG into the post, such as
    <path d="M0 0 q 150 50 300 0" stroke="black" fill="none"/>
    <path d="M0 250 q 150 50 300 0" stroke="black" fill="none"/>
    or similar? I see there is a chance for the SVG to be malformed, so you can't just plug it into the text, but it would be nice if possible.
  2. jcsd
  3. Oct 11, 2015 #2
    I can investigate more, but until then, just how many people know SVG code and would use it?
  4. Oct 11, 2015 #3
    If you ask me, I can only say that it's much simpler than LaTeX.
    Finding a good online SVG editor seems hard, but this is not really a choice between good and bad pictures, it's between being able or unable to post pictures at all.
    What are people using to draw pictures like this one? Is there some favorite scientific picture editor?

  5. Oct 12, 2015 #4


    User Avatar
    Science Advisor
    Gold Member

    I drew this with Inkscape* -- a free SVG editor! -- and exported as a PNG bitmap. With SVG support I could have uploaded the SVG file itself. Note, however, that the SVG file was 554 KB whereas the PNG was only 48 KB.

    In the past not all browsers had native support for SVG, but that may have changed.

    *Well, actually MATLAB drew the pink gridlines for me, and with an SVG add-on exported an SVG file that I then tweaked with Inkscape.
  6. Oct 14, 2015 #5


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

  7. Oct 14, 2015 #6


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Some simple SVG files might be smaller than their png rasterizations. One feature that would be worth exploring is an interactive SVG file.
  8. Oct 14, 2015 #7
    I believe that simply enabling .SVG as the extension for uploaded images wouldn't hurt anyone. SVG is not that new, pretty much all browsers support it well.
    I see that adding a textbox to the upload dialog would leave some people scratching their heads; OTOH the members of this forum are probably educated enough to understand its purpose.
    Clearly, implementing the [SVG] tag is a lot of work for just a few people, I can understand that.

    Do the ##\LaTeX## pictures still work? I tried it but couldn't make any image.
  9. Oct 14, 2015 #8


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Nope. MathJax doesn't seem to support the picture environment.
  10. Oct 14, 2015 #9
    This isn't simple because we'd essentially be allowing for members to post arbitrary HTML and SVG can also embed javascript. You can imagine the security issues. To allow only SVG tags would require substantial custom work.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook