Skip to content

Instantly share code, notes, and snippets.

@spewil
Created October 19, 2019 19:19
Show Gist options
  • Save spewil/6e32adb60f7a1dd188b1cbd0e25a2008 to your computer and use it in GitHub Desktop.
Save spewil/6e32adb60f7a1dd188b1cbd0e25a2008 to your computer and use it in GitHub Desktop.
convert images to vectors
# png/jpg --(mogrify/magick)--> ppm --(mkbitmap)--> pbm --(potrace)--> svg
# mkbitmap parameters:
# -f n == Apply a highpass filter to the image.The parameter n is a radius (in pixels) which corresponds approximately to the size of details which should be preserved.
# -s n == Scale the image by an integer factor n>0.
# -3 == Use cubic interpolation when scaling to a higher resolution.
# -t n == Set the threshold grey value for bilevel conversion.
'''shell
mogrify -format ppm *.jpg
mkbitmap -f 5 -s 2 -3 -t 0.45 *.ppm
potrace -b svg *.pbm
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment