SDL2_Image - 8-Bit PNG Image Support(Alpha Mod Not Working)?


Are 8-bit PNG images fully supported by current SDL2_Image?
Can’t seem to get the alpha transparency mod working on the 8-bit PNG’s?
SDL_SetTextureAlphaMod(Sprites[index].Texture, Sprites[index].Transparency);

Any ideas?
Let us know, thanks!


I can’t comment on SDL2_image, but SDL_SetTextureAlphaMod() seems to be working with an 8-bit PNG loaded using SDL_stbimage (which I prefer because it’s lightweight and has no dependencies).

Well ok…
Someone on IRC recommended “SDL_ConverSurface”, but we are using textures.
How would we convert imported textures to 32Bit while maintaining transparent pixels?



I am confused. I thought both SDL2_image and SDL_stbimage returned a surface (using IMG_Load() or STBIMG_Load() respectively) which you then have to convert to a texture using SDL_CreateTextureFromSurface(). Is that not what you are doing? How do you load your PNG?

Yes… you are right :slight_smile:
Been away from SDL2 dev for many years…


1 Like