added function to convert image pixel data into a vector