Fixed a major performance issue with multi-frame grayscale images (XA).