How to convert images (.jpg) to vectors for image classification
You can use imread function from imageio library with np.array from numpy:

from imageio import imread
import numpy as np
filename = '/path/to/dog.jpg'
vectorized_picture = np.array(imread(filename))


When entering this data into a ML engine, you'll probably need to reshape it to a column matrix (at least in Prof. Andrew Ng's Coursera Machine Learning courses that I've been doing). If so, you can do that by:

reshaped_vectorized_picture = vectorized_picture.reshape(1, -1).T


You need to install both libraries through apt, brew or pip (preferred one)

pip install numpy imageio