added option to force grayscale images