Refactored handling of pixel bytes.