Correctly handling pixel depth.