Added imageIsValid().