Added percentile parameter to layer specification, to improve brightness of rescaled images.
improved percentile handling
adds option to store images in specified folder