fix for crash when computing average image color

If the image has zero size use a default average color rather than trying to divide by zero.