Fixed issue with non-RGB images