-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDL_image + libpng load some PNGs incorrectly #460
Comments
Yes, this looks good to me! |
Also, I fixed the underlying problem in IMG_png.c |
Thanks @slouken! Gave it a run through the pygame-ce test suite and on that image, all worked as expected. |
You're welcome! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I'm one of the maintainers of pygame-ce. One of our users reported a png file loading incorrectly in their program.
The image:
It should look like the left, but instead loads as the right.
This only seems to be an issue when SDL_image is built with libpng (as we do for distribution with pygame-ce). I tested on an SDL_image prebuilt for Windows (built with stb-image instead), and didn't see this bad output.
I looked into how this might be solved in the libpng code, but the libpng code is extremely difficult to understand. Checking the libpng docs I see that they have a "simplified API" for reading and writing, so I spent 2 days hacking on it and have a draft of using the libpng simple API instead of the older API in SDL2_image: https://github.com/pygame-community/SDL_image/blob/a89d6d9b7069e851bdfeecb15e8cc0de6b4542c6/src/IMG_png.c#L233-L367. That branch is still WIP right now, but wanted to float the idea of potentially moving over to that strategy for libpng. It seems a lot simpler than the other libpng code or even the stb-image code. (And it fixes this issue too)
pygame-ce issue: pygame-community/pygame-ce#3036
The text was updated successfully, but these errors were encountered: