Use a simpler and more general check for the gray case in the planarCopy function