Inkscape.org
Beginners' Questions Why does inkscape not display background PNG image when I edit SVG file that references it?
  1. #1
    OwlHoot OwlHoot @OwlHoot

    Hi all.

    I also posted the following question at:

    https://graphicdesign.stackexchange.com/questions/150038/why-does-inkscape-not-display-background-png-image-when-i-edit-svg-file-that-ref

    which I mention here because any replies there may be useful to people reading this here, if that makes sense. Anyway ..

    I have an SVG file which plots points on a background PNG image (a map), and I want to edit it in Inkscape to add points and paths aligned to certain features on the PNG map.

    The PNG image and plot points display fine when I open the SVG with Chrome or (with a glitch or two) Firefox. But when I open the SVG with Inkscape the PNG image does not show up, even though it is in the same directory.

    I would have thought overlaying vector entities on a background raster image was a very common use case, but Googling this with reference to Inkscape shows up no relevant results that I can see.

    Here is an excerpt of the SVG file:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>

            <svg
                xmlns="http://www.w3.org/2000/svg"
                xmlns:xlink="http://www.w3.org/1999/xlink"
                version="1.1"
                id="map-svg"
                viewBox="0 0 8448 6912"
                width="100%"
                height="100%"
                x="0px" y="0px" >

            :::

             <g id="matrix-group" transform="matrix(1 0 0 1 0 0)">
              <image x="0" y="0" width="8448" height="6912" href="northern_ireland.png"></image>
            <line x1="6455" x2="6455" y1="3936" y2="3936" stroke-width="6" stroke="#0000ff" stroke-linecap="round" vector-effect="non-scaling-stroke"/>
            <line x1="6809" x2="6809" y1="3694" y2="3694" stroke-width="6" stroke="#0000ff" stroke-linecap="round" vector-effect="non-scaling-stroke"/>
            <line x1="6462" x2="6462" y1="3924" y2="3924" stroke-width="6" stroke="#0000ff" stroke-linecap="round" vector-effect="non-scaling-stroke"/>

            :::

            </svg>

    Any ideas? Maybe I have to somehow tag the image with a sodipodi reference, of the kind Inkscape seems to use behind the scenes? Or maybe Inkscape doesn't search the current directory for relative paths/names?

    I would be fine with a procedure for manually loading the background PNG image each time I start editing the SVG image, provided the vector components are visible in the foreground. But it would be better if Inkscape could do this automatically.
     

     

     

     

  2. #2
    Polygon Polygon @Polygon🌶

    Could it be the image is just linked (not embedded) and lost file path?

  3. #3
    inklinea inklinea @inklinea⛰️
    *

    Just close the </g>

    The older style xlink:href instead

    There are two files attached, bit difficult to see the svg in the forum. Should be able to download both

     

    Northern Ireland
    Map
Inkscape Inkscape.org Inkscape Forum Beginners' Questions Why does inkscape not display background PNG image when I edit SVG file that references it?