added getPathFromImage function