if ($Image === false) {
            throw new InvalidArgumentException("No or invalid image object provided"); 
        }