added grey imaged output need to have subfolder /images and opening closing