merge path handling from branch UseLibImageMagick++