Move reading and copying an image to functions
Move building all the initial pixel edges to its own function