downsample image when memory is not enougth
input directory on external memory on JB