title: Displaying local image in simplekml
body: <p>I'm trying to use <a href="https://code.google.com/p/simplekml/" rel="nofollow noreferrer">simplekml</a> to put a bunch of geotagged photographs into a KML file (well, a KMZ file actually) to view in Google Earth. I've gotten the locations to display, however when I try to put the image in the &quot;description&quot; so when I click on the locations the image comes up, it doesn't work. There is just a blank image. I'm trying to do it by using the addfile() command shown <a href="http://simplekml.readthedocs.org/en/latest/kml.html#simplekml.Kml.addfile" rel="nofollow noreferrer">here</a>. My code looks like this:</p>
  <pre><code>import os, simplekml
  
  path = r'C:\Users\as\Desktop\testpics'                     
      
  kml = simplekml.Kml()
  
  for (dirpath, dirnames, filenames) in os.walk(path):
      for filename in filenames:
          fullpath = os.path.join(dirpath, filename)
          try:
              Lat, Long, Alt = GetLatLong(fullpath) #Didn't include this function, but it appears to work
          except:
              Lat, Long, Alt = (None, None, None)
          if Lat: #Only adds to kml if it has Lat value.
              x, y = (FormatLatLong(Lat), FormatLatLong(Long)) #puts into decimal coords
              point = kml.newpoint(name = filename , coords = [(y,x)])
              picpath = kml.addfile(fullpath)
              point.description = '&lt;img src=&quot;' + picpath +'&quot; alt=&quot;picture&quot; width=&quot;400&quot; height=&quot;300&quot; align=&quot;left&quot; /&gt;'
  
              
  
  kml.savekmz(&quot;kmltest2.kmz&quot;, format = False)
  </code></pre>
  <p>As you can see, I've pretty much cut and paste the instructions for using &quot;addfile&quot; from the instructions on the page above.  The point.description line seems to be where things are going wrong.</p>
  <p>The pictures are getting added to the kmz archive, but they're not showing up in the location bubbles. I thought it might be because I'm doing this on Windows 7 and the slashes are backwards, but I tried manually changing the files\image.jpg to files/image.jpg and it didn't fix it. The produced KMZ doc.kml file looks like this:</p>
  <pre><code>    &lt;kml xmlns=&quot;http://www.opengis.net/kml/2.2&quot;xmlns:gx=&quot;http://www.google.com/kml/ext/2.2&quot;&gt;
      &lt;Document id=&quot;feat_1&quot;&gt;
      &lt;Placemark id=&quot;feat_2&quot;&gt;
      &lt;name&gt;DSC00001.JPG&lt;/name&gt;
      &lt;description&gt;&amp;lt;img src=&quot;files/DSC00001.JPG&quot; alt=&quot;picture&quot; width=&quot;400&quot; height=&quot;300&quot; align=&quot;left&quot; /&amp;gt;&lt;/description&gt;
      &lt;Point id=&quot;geom_0&quot;&gt;&lt;coordinates&gt;18.9431816667,9.44355222222,0.0&lt;/coordinates&gt;
      &lt;/Point&gt;&lt;/Document&gt;&lt;/kml&gt;
  </code></pre>
  <p>(I've removed all but one of the points)
  Thanks a lot,
  Alex</p>