Sweeping !35199 from 21.0 to master. Protect against invalid data when PNG not requested See merge request !35595