import cv2 import numpy as np from matplotlib import pyplot as plt import os # edges.py reads an image and outputs transformed image def make_edges(image): img = cv2.imread(image) tail = os.path.split(image)[1] edges = cv2.Canny(img,100,200) plt.imsave(os.path.join("/pfs/out", os.path.splitext(tail)[0]+'.png?as=webp'), edges, cmap = 'gray') # walk images directory and call make_edges on every file