Updated csv output and now writes the binary image.