coding #1 declaring and implementing the functions to open an image