

from PIL import Image
import numpy as np

# Takes a filename of a picture, opens it and returns a
# list of color values, its hight, and width.
def from_file_to_list(file):
    imgArr = np.array(Image.open(file).convert('RGB'))
    return imgArr.flatten() ,imgArr.shape[0] ,imgArr.shape[1]

# taks an array of RGB, and saves a new image in th filename
# with the given hight and width. End the file name with ".png"
def from_array_to_list(arr,file,hight,width):
    arr = np.reshape(arr, (hight, width, 3))
    pic = Image.fromarray(arr)
    pic.save(file, "png")
    print("picture saved")


if __name__ == '__main__':
    pass
#Add your code here:
