Skip to content

Instantly share code, notes, and snippets.

@klokan
Created November 10, 2014 10:41
Show Gist options
  • Save klokan/9ebdbff5f874ec2c77dc to your computer and use it in GitHub Desktop.
Save klokan/9ebdbff5f874ec2c77dc to your computer and use it in GitHub Desktop.
svg polygon to html image map
import sys
print """<map id ="map" name="map">"""
for s in sys.stdin:
x, y = 0, 0
out = ""
for i,j in [ map(float, r.split(',')) for r in s.split() ]:
x += i
y += j
out += "%d,%d," % (x,y)
if out:
print """<area shape="poly" coords="%s" href="" alt="" />""" % out[:-1]
print """</map>"""
print """<img src="mapa-mollova-sbirka.png" usemap="#map" alt="">"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment