Python: Working with pixels