Convert image to RGB if necessary.