Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Thanks for your help!</p> <p>Although <strong>Jonathans</strong> hint to use the Sobel filter definitely would work, I chose <strong>Sparrs</strong> approach of first converting the bitmap into a vector image (via Inkscape) and then processing the SVG file. After studying some of the basics of the SVG spec, it was pretty easy to extract the - for HTML image maps needed - X/Y coordinates from all the other junk and generate a suitable code.</p> <p>Although it’s no rocket science, someone might find this piece of code useful:</p> <pre><code>// input format: M 166,362.27539 C 163.525,360.86029 161.3875,359.43192 161.25,359.10124 C ... private static void Svg2map(string svg_input) { StringBuilder stringToFile = new StringBuilder(); // get rid of some spaces and characters var workingString = svg_input.Replace("z", "").Replace(" M ", "M").Replace(" C ", "C"); // split into seperate polygons var polygons = workingString.Split('M'); foreach (var polygon in polygons) { if (!polygon.Equals(String.Empty)) { // each polygon is a clickable area stringToFile.Append("&lt;area shape=\"poly\" coords=\""); // split into point information var positionInformation = polygon.Split('C'); foreach (var position in positionInformation) { var noise = position.Trim().Split(' '); // only the first x/y-coordinates after C are relevant var point = noise[0].Split(','); foreach (var value in point) { var valueParts = value.Split('.'); // remove part after comma - we don't need this accurancy in HTML stringToFile.Append(valueParts[0]); // comma for seperation - don't worry, we'll clean the last ones within an area out later stringToFile.Append(","); } } stringToFile.AppendLine("\" href=\"targetpage.html\" alt=\"Description\" /&gt;"); } } // clean obsolete commas - not pretty nor efficient stringToFile = stringToFile.Replace(",\"", "\""); var fs = new StreamWriter(new FileStream("output.txt", FileMode.Create)); fs.Write(stringToFile.ToString()); fs.Close(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload