Converting image to vector?

This may be a basic question / me being lazy, but every source that I’ve gotten into lays heavy entire systems and it’s hard to get into models from a higher level (coding) so I’d like to just start with generating a image from a vector, can someone explain what’s going on / how to do it in python?

Need to get labels and the vectors converted:

    label1 = np.asarray(json.loads(request.form['label1']), dtype='float64')
    label2 = np.asarray(json.loads(request.form['label2']), dtype='float64')
    vector1 = np.asarray(json.loads(request.form['vector1']), dtype='float64')
    vector2 = np.asarray(json.loads(request.form['vector2']), dtype='float64')

    new_vectors, new_labels = interpolate(12, vector1, vector2, label1, label2)
    new_ims = sample(new_vectors, new_labels)
    result = PIL.Image.fromarray(new_ims)"test.png")
    return jsonify([
        [ encode_img(arr) for arr in new_ims ],