Introducing StbImageJava

StbImageJava is Java port of stb_image.h 2.22. Or - in other words - it’s a pure Java library without any native dependencies that can load images in JPG, PNG, BMP, TGA, PSD and GIF formats.

If the project will attract interest, I may also port stb_imagewrite.h and stb_truetype.h


I think other than PSD, Java’s ImageIO class can load all of those formats already with no external dependencies. I guess it’s possible that TGA is still not supported.

In what environment did you envision a need for this?

Still libgdx and lwjgl use stb through JNI. So prob there is some need.

Hmmm… it seems in lwjgl’s case, it’s at least partially because of their own GLFW bugs: Not sure I buy the “tons of overhead” argument but whatever.

I was just curious what the need was.

Android seems like the other reason… though I guess google says some folks have ported ImageIO to android.

Well: We also use stb_image natively, I think for Android and iOS, yeah.
Actually AWT is only available on Windows, Mac and Linux

This is quite useful anywhere AWT is not available, and it’s also useful for avoiding dependencies on native libs and the pain they bring.

Thought it sounds like JME already has this wired up for those cases.

1 Like

The library is now available at the bintray/jcenter: