Red and green channels swapped when saving PNG

Issue #211 resolved
Jeremy Thurgood
created an issue

The change mentioned in https://bitbucket.org/pygame/pygame/issue/39 seems to have broken PNG saving by swapping the red and green channels. I don't have suitable hardware to test the big-endian logic, but I suspect that commit also breaks JPEG saving on big-endian architectures while not fixing PNG saving.

I recommend reverting the commit.

Comments (14)

  1. Jason Marshall

    To confirm that the changes are correct so that this issue can be closed, pygame must be built on big-endian architecture. If someone has the ability, time & interest to do this chore but lacks the necessary hardware, I will gladly put an iMac G4 in a box and ship it to that person (in the USA or Canada).

  2. Kris De Volder

    Oh sorry, maybe I misunderstood. It seemed to me discussion ended up with not fixing the bug and resolving the issue only with a comment 'We are not supporting big endian at the moment'.

    So you are saying bug is actually fixed?

    That's great then. All I can say in that case is keep up the good work :-)

  3. eracoon

    I wonder why I still have this bug on a freshly installed raspbian. I kinda new at this but after a year and many updates I suppose that should've trickled down the the standard install, right? What can I do to fix this issue on my local install.. what file do I need to modify to fix this issue with the flipped channels?

  4. Lenard Lindstrom

    To clarify the big-endian issue: big-endian support was not dropped from Pygame. Big-endian support is built into existing code, and will continue to be added to new code. And, big-endian bugs will still be addressed. However, until some reliable way of testing Pygame on a big-endian platform is provided these bug fixes will go untested and the Pygame release schedule will continue without interruption.

  5. eracoon

    I'm sorry... kinda of a noob when it comes to endian thingies. not sure I fully understand what that means or how this affects the colors being swapped in png but not bmp. Keep in mind though I just started using pygame and python in general 2 weeks ago... so I might be missing out in experience in some areas. Is there a way for me to create a png with the colors in the correct channels? I tried to find a solution on my own but was overwhelmed with a lot of half solutions. Is there a file I can change in my rapsbian install to make the PNG have rgb instead of grb.

    Since so far I only found this thread about it it means that not a lot of people use the write to png function... or are able to solve it in some way I'm unaware of. pointing me to the right direction would be very very helpful :)

  6. Log in to comment