technologiestiftung / maps-latent-space

An AI exploration on how to create maps and a infrastructure to display it in an exhibition space. A collaboration between Birds On Mars and Technologiestiftung Berlin/CityLAB.
MIT License
0 stars 0 forks source link

Convert png to svg #35

Open ff6347 opened 4 years ago

ff6347 commented 4 years ago
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'

# simple script for converting png files in the current directory to svg files
function main() {

  for pic in *.png; do
    echo "working on:    $pic"
    convert "$pic" -colorspace Gray "$pic"
    echo "done with gray space"
    convert "gray-$pic" -negate -threshold 38.1% -negate "$pic"
    echo "done with threshold"
    convert "$pic" "$pic.pnm"
    potrace "$pic.pnm" -s -o "${pic%%.*}.svg"
    echo "done with svg"
  done
}