Hi,
I wrote a little Java wrapper for the FreeImage(
http://freeimage.sourceforge.net/) library in order to use it with LWJGL for texture loading. Not all functions are wrapped but the most important ones are. This includes of course image loading and saving, some conversion functions and simple image manipulation like contrast and brightness adjustment, rotation and scaling. The garbage collector is taking care of no longer needed images. So you do not have to call "UnloadImage" or stuff like that to get back your memory. Here is a sample loadTexture method:
private int loadTexture(String path) {
FreeImage fi = null;
try {
fi = new FreeImage(new File(path));
} catch ( FreeImageException e ) {
e.printStackTrace();
}
if (fi.getBitsPerPixel() != 24 ) {
fi = fi.convertTo24Bits();
}
// Create A IntBuffer For Image Address In Memory
IntBuffer buf = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
GL11.glGenTextures(buf); // Create Texture In OpenGL
// Create MipMapped Texture
GL11.glBindTexture(GL11.GL_TEXTURE_2D, buf.get(0));
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_NEAREST);
GLU.gluBuild2DMipmaps(GL11.GL_TEXTURE_2D, GL11.GL_RGB, fi.getWidth(),fi.getHeight(), GL12.GL_BGR, GL11.GL_UNSIGNED_BYTE, fi.getPixelBuffer());
return int buf.get(0); // Return TextureId
}
Finally here are the links:
http://www.goto3d.de/freeimage4j/freeimage4j.jar (java classes)
http://www.goto3d.de/freeimage4j/freeimage4j.dll (win32 dll)
http://www.goto3d.de/freeimage4j/libfreeimage4j.so (linux x86_64 shared object)
http://www.goto3d.de/freeimage4j/freeimage4j-docs.zip (javadocs)
http://www.goto3d.de/freeimage4j/freeimage4j-src.zip (the complete source code)
If you want to build the source code by yourself please read the included README file.
Cheers!