You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tiletool / paltool rely on PyGame (which relies on SDL_image) to load input images transparently, without having to care about the image file format. Currently, it expects a palette-based image but works equally well with palette-based png or gif images.
However recent version of SDL_image added support for stb_image as way to load .png files (instead of libpng), and std_image always returns a true-color surface to PyGame, as explained in their code:
// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized.
This breaks tiletool / paltool as this mangles the pixel information from the file, and it removes the palette information from the SDL surface.
Consequently, PyGame returns different information to tiletool / paltool depending on how SDL_image is compiled (with or without stb_image). This is confusing and can't be easily avoided.
The text was updated successfully, but these errors were encountered:
When PyGame is built with support for stb_image, the latter
automatically translates paletted png to full color surfaces,
thus losing palette and pixel data.
Move all the png assets to gif, to ensure that PyGame will
always be able to load images, no matter how it is compiled
in the environment.
Ref dciabrin/ngdevkit#96
tiletool / paltool rely on PyGame (which relies on SDL_image) to load input images transparently, without having to care about the image file format. Currently, it expects a palette-based image but works equally well with palette-based png or gif images.
However recent version of SDL_image added support for stb_image as way to load .png files (instead of libpng), and std_image always returns a true-color surface to PyGame, as explained in their code:
This breaks tiletool / paltool as this mangles the pixel information from the file, and it removes the palette information from the SDL surface.
Consequently, PyGame returns different information to tiletool / paltool depending on how SDL_image is compiled (with or without stb_image). This is confusing and can't be easily avoided.
The text was updated successfully, but these errors were encountered: