Removed color image related code to improve speed.