added an extra parameter to define the root of the image location