this patch was originally posted on issue #7704 and was slightly adjusted to check for the availability of the pixel format.