Added try/catch when reading pixel data.