fixed problem with file path, was an issue inside of the file path returned by openImage():
it originally had  "file://" at begining of string of the file path
used path = imgPath.getAbsolutePath() to solve this problem.