import cv2 import copy # code for function by ospider # https://stackoverflow.com/questions/43108751/convert-contour-paths-to-svg-paths def saveContoursAsSVG(contours, width, height, filename): with open(filename, "w+") as f: f.write(f'') for c in contours: f.write('') f.write("") image = cv2.imread("test.png") image2 = copy.deepcopy(image) # image to overwrite with contours # do contour detection WOW image = cv2.Canny(image, 150, 200) contours, hierachy = cv2.findContours(image, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) cv2.drawContours(image2, contours, -1, (255,255,255), 3) while True: cv2.imshow("FUCKSKFKSDG", image2) key = cv2.waitKey(1) if key == ord('q'): break elif key == ord('w'): saveContoursAsSVG(contours, image2, "test.svg") ## this is nasty soz cv2.destroyAllWindows()