adding code to convert image to graph